Initial Checkin
This commit is contained in:
25
WPicView.sln
Normal file
25
WPicView.sln
Normal file
@@ -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
|
||||
9
WPicView/App.xaml
Normal file
9
WPicView/App.xaml
Normal file
@@ -0,0 +1,9 @@
|
||||
<Application x:Class="WPicView.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:WPicView"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
17
WPicView/App.xaml.cs
Normal file
17
WPicView/App.xaml.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
10
WPicView/AssemblyInfo.cs
Normal file
10
WPicView/AssemblyInfo.cs
Normal file
@@ -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)
|
||||
)]
|
||||
10
WPicView/MainWindow.xaml
Normal file
10
WPicView/MainWindow.xaml
Normal file
@@ -0,0 +1,10 @@
|
||||
<Window x:Class="WPicView.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:WPicView"
|
||||
mc:Ignorable="d"
|
||||
Title="MainXWindow" Height="450" Width="800" KeyDown="OnKeyDownHandler" WindowState="Maximized">
|
||||
<Image x:Name="IMG1" HorizontalAlignment="Left" VerticalAlignment="Top" Opacity="0.99"/>
|
||||
</Window>
|
||||
137
WPicView/MainWindow.xaml.cs
Normal file
137
WPicView/MainWindow.xaml.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
18
WPicView/WPicView.csproj
Normal file
18
WPicView/WPicView.csproj
Normal file
@@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<COMReference Include="{215d64d2-031c-33c7-96e3-61794cd1ee61}">
|
||||
<Guid>215d64d2-031c-33c7-96e3-61794cd1ee61</Guid>
|
||||
<VersionMajor>2</VersionMajor>
|
||||
<VersionMinor>4</VersionMinor>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user