Improve navigation

This commit is contained in:
Joe Tretter
2020-05-14 11:17:56 -05:00
parent 6f1bcd8382
commit f114d04cac
2 changed files with 21 additions and 6 deletions

View File

@@ -39,6 +39,7 @@ namespace WPicView
allDirs = System.IO.Directory.GetDirectories(System.Environment.GetEnvironmentVariable ("USERPROFILE") + "\\SShot", "202*"); allDirs = System.IO.Directory.GetDirectories(System.Environment.GetEnvironmentVariable ("USERPROFILE") + "\\SShot", "202*");
dPos = allDirs.Length - 1; dPos = allDirs.Length - 1;
allFiles = System.IO.Directory.GetFiles(allDirs[dPos], searchPattern); allFiles = System.IO.Directory.GetFiles(allDirs[dPos], searchPattern);
fPos = allFiles.Length-1;
this.Title = allFiles[fPos]; this.Title = allFiles[fPos];
IMG1.Source = new BitmapImage(new Uri(allFiles[fPos])); IMG1.Source = new BitmapImage(new Uri(allFiles[fPos]));
group.Children.Add(st); group.Children.Add(st);
@@ -55,7 +56,7 @@ namespace WPicView
{ {
dPos -= 1; dPos -= 1;
allFiles = System.IO.Directory.GetFiles(allDirs[dPos], searchPattern); allFiles = System.IO.Directory.GetFiles(allDirs[dPos], searchPattern);
fPos = 0; fPos = allFiles.Length -1;
} }
} }
else if (e.Key == System.Windows.Input.Key.Down) else if (e.Key == System.Windows.Input.Key.Down)
@@ -64,7 +65,7 @@ namespace WPicView
{ {
dPos += 1; dPos += 1;
allFiles = System.IO.Directory.GetFiles(allDirs[dPos], searchPattern); 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) if (allFiles.Length > 0)
{ {
this.Title = allFiles[fPos]; this.Title = allFiles[fPos];
@@ -111,25 +122,25 @@ namespace WPicView
{ {
IMG1.RenderTransform = group; IMG1.RenderTransform = group;
tt.X -= 10; tt.X -= 25;
} }
if (e.Key == System.Windows.Input.Key.H) if (e.Key == System.Windows.Input.Key.H)
{ {
IMG1.RenderTransform = group; IMG1.RenderTransform = group;
tt.X += 10; tt.X += 25;
} }
if (e.Key == System.Windows.Input.Key.J) if (e.Key == System.Windows.Input.Key.J)
{ {
IMG1.RenderTransform = group; IMG1.RenderTransform = group;
tt.Y -= 10; tt.Y -= 25;
} }
if (e.Key == System.Windows.Input.Key.K) if (e.Key == System.Windows.Input.Key.K)
{ {
IMG1.RenderTransform = group; IMG1.RenderTransform = group;
tt.Y += 10; tt.Y += 25;
} }
} }

View File

@@ -6,6 +6,10 @@
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath></OutputPath>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<COMReference Include="{215d64d2-031c-33c7-96e3-61794cd1ee61}"> <COMReference Include="{215d64d2-031c-33c7-96e3-61794cd1ee61}">
<Guid>215d64d2-031c-33c7-96e3-61794cd1ee61</Guid> <Guid>215d64d2-031c-33c7-96e3-61794cd1ee61</Guid>