From f114d04cacbc48b351697c497aac911ba1397164 Mon Sep 17 00:00:00 2001 From: Joe Tretter Date: Thu, 14 May 2020 11:17:56 -0500 Subject: [PATCH] Improve navigation --- WPicView/MainWindow.xaml.cs | 23 +++++++++++++++++------ WPicView/WPicView.csproj | 4 ++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/WPicView/MainWindow.xaml.cs b/WPicView/MainWindow.xaml.cs index a557856..d4c84b9 100644 --- a/WPicView/MainWindow.xaml.cs +++ b/WPicView/MainWindow.xaml.cs @@ -39,6 +39,7 @@ namespace WPicView allDirs = System.IO.Directory.GetDirectories(System.Environment.GetEnvironmentVariable ("USERPROFILE") + "\\SShot", "202*"); dPos = allDirs.Length - 1; allFiles = System.IO.Directory.GetFiles(allDirs[dPos], searchPattern); + fPos = allFiles.Length-1; this.Title = allFiles[fPos]; IMG1.Source = new BitmapImage(new Uri(allFiles[fPos])); group.Children.Add(st); @@ -55,7 +56,7 @@ namespace WPicView { dPos -= 1; allFiles = System.IO.Directory.GetFiles(allDirs[dPos], searchPattern); - fPos = 0; + fPos = allFiles.Length -1; } } else if (e.Key == System.Windows.Input.Key.Down) @@ -64,7 +65,7 @@ namespace WPicView { dPos += 1; allFiles = System.IO.Directory.GetFiles(allDirs[dPos], searchPattern); - fPos = 0; + fPos = allFiles.Length - 1; } } @@ -80,6 +81,16 @@ namespace WPicView } } + if (e.Key == Key.End) + { + fPos = allFiles.Length - 1; + } + if (e.Key == Key.Home ) + { + fPos = 0; + } + + // Display file if (allFiles.Length > 0) { this.Title = allFiles[fPos]; @@ -111,25 +122,25 @@ namespace WPicView { IMG1.RenderTransform = group; - tt.X -= 10; + tt.X -= 25; } if (e.Key == System.Windows.Input.Key.H) { IMG1.RenderTransform = group; - tt.X += 10; + tt.X += 25; } if (e.Key == System.Windows.Input.Key.J) { IMG1.RenderTransform = group; - tt.Y -= 10; + tt.Y -= 25; } if (e.Key == System.Windows.Input.Key.K) { IMG1.RenderTransform = group; - tt.Y += 10; + tt.Y += 25; } } diff --git a/WPicView/WPicView.csproj b/WPicView/WPicView.csproj index f783516..40d6ea0 100644 --- a/WPicView/WPicView.csproj +++ b/WPicView/WPicView.csproj @@ -6,6 +6,10 @@ true + + + + 215d64d2-031c-33c7-96e3-61794cd1ee61