commit 6f1bcd83826a19e26f7b66158a495a2232359750 Author: Joe Tretter Date: Wed May 13 15:31:35 2020 -0500 Initial Checkin diff --git a/WPicView.sln b/WPicView.sln new file mode 100644 index 0000000..7f3a55c --- /dev/null +++ b/WPicView.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30011.22 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPicView", "WPicView\WPicView.csproj", "{CB75E611-A07D-4628-8565-2F10D6B98D4B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CB75E611-A07D-4628-8565-2F10D6B98D4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB75E611-A07D-4628-8565-2F10D6B98D4B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB75E611-A07D-4628-8565-2F10D6B98D4B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB75E611-A07D-4628-8565-2F10D6B98D4B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4476BEC4-662B-470E-AD4D-B27471E1C390} + EndGlobalSection +EndGlobal diff --git a/WPicView/App.xaml b/WPicView/App.xaml new file mode 100644 index 0000000..7e74e27 --- /dev/null +++ b/WPicView/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/WPicView/App.xaml.cs b/WPicView/App.xaml.cs new file mode 100644 index 0000000..1706061 --- /dev/null +++ b/WPicView/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace WPicView +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/WPicView/AssemblyInfo.cs b/WPicView/AssemblyInfo.cs new file mode 100644 index 0000000..74087a1 --- /dev/null +++ b/WPicView/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/WPicView/MainWindow.xaml b/WPicView/MainWindow.xaml new file mode 100644 index 0000000..6a49821 --- /dev/null +++ b/WPicView/MainWindow.xaml @@ -0,0 +1,10 @@ + + + diff --git a/WPicView/MainWindow.xaml.cs b/WPicView/MainWindow.xaml.cs new file mode 100644 index 0000000..a557856 --- /dev/null +++ b/WPicView/MainWindow.xaml.cs @@ -0,0 +1,137 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace WPicView +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + string[] allFiles = null; + string[] allDirs = null; + int fPos = 0; + int dPos ; + string searchPattern = "*.png"; + + ScaleTransform st = new ScaleTransform(); + TranslateTransform tt = new TranslateTransform(); + TransformGroup group = new TransformGroup(); + + + public MainWindow() + { + InitializeComponent(); + // allFiles = System.IO.Directory.GetFiles("C:\\Users\\U15020\\SShot\\2020-05-01"); + + allDirs = System.IO.Directory.GetDirectories(System.Environment.GetEnvironmentVariable ("USERPROFILE") + "\\SShot", "202*"); + dPos = allDirs.Length - 1; + allFiles = System.IO.Directory.GetFiles(allDirs[dPos], searchPattern); + this.Title = allFiles[fPos]; + IMG1.Source = new BitmapImage(new Uri(allFiles[fPos])); + group.Children.Add(st); + group.Children.Add(tt); + + } + + private void OnKeyDownHandler(object sender, KeyEventArgs e) + { + // Directory Navigation + if (e.Key == System.Windows.Input.Key.Up) + { + if (dPos > 0) + { + dPos -= 1; + allFiles = System.IO.Directory.GetFiles(allDirs[dPos], searchPattern); + fPos = 0; + } + } + else if (e.Key == System.Windows.Input.Key.Down) + { + if (dPos < allDirs.Length - 1) + { + dPos += 1; + allFiles = System.IO.Directory.GetFiles(allDirs[dPos], searchPattern); + fPos = 0; + } + } + + // File Navigation + if (e.Key == System.Windows.Input.Key.Right) { + if (fPos < allFiles.Length -1 ) { + fPos += 1; + } + + } else if (e.Key == System.Windows.Input.Key.Left) { + if (fPos > 0) { + fPos -= 1; + } + } + + if (allFiles.Length > 0) + { + this.Title = allFiles[fPos]; + IMG1.Source = new BitmapImage(new Uri(allFiles[fPos])); + } + + // zoom - TODO + if (e.Key == System.Windows.Input.Key.PageUp) + { + //https://stackoverflow.com/questions/741956/pan-zoom-image + + IMG1.RenderTransform = group; + + st.ScaleX += 0.2; + st.ScaleY += 0.2; + + } + if (e.Key == System.Windows.Input.Key.PageDown) + { + //https://stackoverflow.com/questions/741956/pan-zoom-image + + IMG1.RenderTransform = group; + + st.ScaleX -= 0.2; + st.ScaleY -= 0.2; + + } + if (e.Key == System.Windows.Input.Key.L) + { + IMG1.RenderTransform = group; + + tt.X -= 10; + } + if (e.Key == System.Windows.Input.Key.H) + { + IMG1.RenderTransform = group; + + tt.X += 10; + } + if (e.Key == System.Windows.Input.Key.J) + { + IMG1.RenderTransform = group; + + tt.Y -= 10; + } + if (e.Key == System.Windows.Input.Key.K) + { + IMG1.RenderTransform = group; + + tt.Y += 10; + } + + } + } +} diff --git a/WPicView/WPicView.csproj b/WPicView/WPicView.csproj new file mode 100644 index 0000000..f783516 --- /dev/null +++ b/WPicView/WPicView.csproj @@ -0,0 +1,18 @@ + + + + WinExe + netcoreapp3.1 + true + + + + + 215d64d2-031c-33c7-96e3-61794cd1ee61 + 2 + 4 + tlbimp + + + + \ No newline at end of file