Add all files
25
PictureViewer.sln
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27004.2006
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PictureViewer", "PictureViewer\PictureViewer.csproj", "{8A346D98-6813-4ECF-B7D4-99A61FC2310D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8A346D98-6813-4ECF-B7D4-99A61FC2310D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8A346D98-6813-4ECF-B7D4-99A61FC2310D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8A346D98-6813-4ECF-B7D4-99A61FC2310D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8A346D98-6813-4ECF-B7D4-99A61FC2310D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {70033B2E-1C44-4996-95F6-C5AF9A8568A7}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
23
PictureViewer/AboutWindow.xaml
Normal file
|
@ -0,0 +1,23 @@
|
|||
<Window x:Class="PictureViewer.AboutWindow"
|
||||
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:PictureViewer"
|
||||
mc:Ignorable="d"
|
||||
Title="About" WindowStartupLocation="CenterOwner" ResizeMode="NoResize" Icon="Resources/Question_16x.png" ShowInTaskbar="False" SizeToContent="WidthAndHeight"
|
||||
Background="{x:Static SystemColors.ControlBrush}">
|
||||
<StackPanel Margin="10">
|
||||
<TextBlock Padding="0,0,0,10">
|
||||
Picture Viewer
|
||||
</TextBlock>
|
||||
<Grid>
|
||||
<Border BorderBrush="{x:Static SystemColors.ActiveBorderBrush}" BorderThickness="1">
|
||||
<ScrollViewer Padding="5,0" Height="150" Width="400" Background="White">
|
||||
<TextBlock x:Name="txtDesc" TextWrapping="Wrap" Margin="0,5"></TextBlock>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Button Content="OK" HorizontalAlignment="Right" Margin="0,10,0,0" Padding="20,1" IsDefault="True" Click="OK_Click" />
|
||||
</StackPanel>
|
||||
</Window>
|
23
PictureViewer/AboutWindow.xaml.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System.Windows;
|
||||
using System.Reflection;
|
||||
using System;
|
||||
|
||||
namespace PictureViewer {
|
||||
public partial class AboutWindow : Window {
|
||||
public AboutWindow() {
|
||||
InitializeComponent();
|
||||
|
||||
Assembly app = Assembly.GetExecutingAssembly();
|
||||
AssemblyTitleAttribute title = (AssemblyTitleAttribute)app.GetCustomAttributes(typeof(AssemblyTitleAttribute), false)[0];
|
||||
AssemblyDescriptionAttribute desc = (AssemblyDescriptionAttribute)app.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)[0];
|
||||
|
||||
Version ver = app.GetName().Version;
|
||||
|
||||
txtDesc.Text = title.Title + "\nVersion " + ver.ToString() + "\n\n" + desc.Description;
|
||||
}
|
||||
|
||||
private void OK_Click(object sender, RoutedEventArgs e) {
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
16
PictureViewer/AddImageURL.xaml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<Window x:Class="PictureViewer.AddImageURL"
|
||||
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:PictureViewer"
|
||||
mc:Ignorable="d"
|
||||
Title="Add Image URL" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" SizeToContent="WidthAndHeight" ResizeMode="NoResize" Icon="Resources/Web.ico">
|
||||
<StackPanel Margin="5">
|
||||
<TextBlock Margin="0,0,0,5">
|
||||
Enter Address:
|
||||
</TextBlock>
|
||||
<TextBox x:Name="txtURL" Width="300" Margin="0,0,0,5" Text="http://"/>
|
||||
<Button Content="OK" Width="60" HorizontalAlignment="Right" IsDefault="True" Click="OK_Clicked"/>
|
||||
</StackPanel>
|
||||
</Window>
|
31
PictureViewer/AddImageURL.xaml.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Windows;
|
||||
|
||||
namespace PictureViewer {
|
||||
public partial class AddImageURL : Window {
|
||||
public Uri Address {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public AddImageURL() {
|
||||
InitializeComponent();
|
||||
Address = null;
|
||||
txtURL.Focus();
|
||||
}
|
||||
|
||||
private void OK_Clicked(object sender, RoutedEventArgs e) {
|
||||
String url = txtURL.Text;
|
||||
bool res = Uri.TryCreate(url, UriKind.Absolute, out Uri outUri)
|
||||
&& (outUri.Scheme == Uri.UriSchemeHttp
|
||||
|| outUri.Scheme == Uri.UriSchemeHttps);
|
||||
|
||||
if (!res) {
|
||||
MessageBox.Show("Invalid Address", "Invalid Address");
|
||||
} else {
|
||||
Address = outUri;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
6
PictureViewer/App.config
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7" />
|
||||
</startup>
|
||||
</configuration>
|
9
PictureViewer/App.xaml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<Application x:Class="PictureViewer.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PictureViewer"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
15
PictureViewer/App.xaml.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace PictureViewer {
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application {
|
||||
}
|
||||
}
|
21
PictureViewer/AskForTime.xaml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<Window x:Class="PictureViewer.AskForTime"
|
||||
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:PictureViewer"
|
||||
mc:Ignorable="d"
|
||||
Title="Set Animation Time" ResizeMode="NoResize" SizeToContent="WidthAndHeight">
|
||||
<StackPanel Margin="10">
|
||||
<DockPanel Margin="0,0,0,10">
|
||||
<TextBlock DockPanel.Dock="Left" Margin="0,0,10,0">
|
||||
Time in seconds:
|
||||
</TextBlock>
|
||||
<TextBox x:Name="txtTime" MinWidth="100"/>
|
||||
</DockPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0">
|
||||
<Button Content="OK" Width="50" IsDefault="True" Margin="0,0,10,0" Click="BtnOK_Clicked" />
|
||||
<Button Content="Cancel" Width="50" IsCancel="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Window>
|
38
PictureViewer/AskForTime.xaml.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Windows;
|
||||
|
||||
namespace PictureViewer {
|
||||
public partial class AskForTime : Window {
|
||||
public double time;
|
||||
private string type;
|
||||
|
||||
public AskForTime(double defaultValue, string name, string type) {
|
||||
InitializeComponent();
|
||||
this.txtTime.Text = defaultValue.ToString();
|
||||
this.Title = "Change " + name + " Time";
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
private void BtnOK_Clicked(object sender, RoutedEventArgs e) {
|
||||
if (type.Equals("int")) {
|
||||
bool res = int.TryParse(this.txtTime.Text, out int newTime);
|
||||
if (res && newTime >= 0) {
|
||||
this.time = newTime;
|
||||
this.DialogResult = true;
|
||||
this.Close();
|
||||
} else {
|
||||
MessageBox.Show("Invalid time: " + this.txtTime.Text, "Invalid Time", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
} else {
|
||||
bool res = Double.TryParse(this.txtTime.Text, out double newTime);
|
||||
if (res && newTime >= 0) {
|
||||
this.time = newTime;
|
||||
this.DialogResult = true;
|
||||
this.Close();
|
||||
} else {
|
||||
MessageBox.Show("Invalid time: " + this.txtTime.Text, "Invalid Time", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
180
PictureViewer/MainWindow.xaml
Normal file
|
@ -0,0 +1,180 @@
|
|||
<Window x:Class="PictureViewer.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:PictureViewer"
|
||||
mc:Ignorable="d"
|
||||
Title="Picture Viewer" Icon="Resources/Image.ico" MinWidth="350" MinHeight="300" Width="500" Height="350">
|
||||
<Window.Resources>
|
||||
<ContextMenu x:Key="imageMenu">
|
||||
<MenuItem Header="Remove Image" Click="RemoveImage_Clicked">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources/ClearWindowContent_16x.png"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Window.Resources>
|
||||
<DockPanel>
|
||||
<Menu DockPanel.Dock="Top">
|
||||
<MenuItem Header="File">
|
||||
<MenuItem Header="Open Files..." Click="OpenFiles_Clicked">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources/OpenFolder.ico"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Open URL..." Click="LoadURL_Clicked">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources/Web.ico"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator/>
|
||||
<MenuItem Header="E_xit" Click="Exit_Clicked">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources/Close_16x.png"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Images">
|
||||
<MenuItem x:Name="mnuClear" Header="_Clear Queue" Click="ClearQueue_Clicked" IsEnabled="False">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources/CleanData_16x.png"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator/>
|
||||
<MenuItem x:Name="mnuStart" Header="_Start" Click="Start_Clicked" IsEnabled="False">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources/Run.ico"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem x:Name="mnuPause" Header="_Pause" Click="Pause_Clicked" IsEnabled="False">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources/Pause.ico"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem x:Name="mnuPrev" Header="_Previous" Click="Previous_Clicked" IsEnabled="False">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources/Previous.ico"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem x:Name="mnuNext" Header="_Next" Click="Next_Clicked" IsEnabled="False">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources/Next_16x.png"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="View">
|
||||
<MenuItem Header="Change Animation Length" Click="OnChangeAnimLength_Clicked">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources/Time.ico" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Change Slideshow Image Time" Click="OnChangeSlideDelay_Clicked">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources/TransitioningContentControl_16x.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem x:Name="mnuResizeWindow" Header="Resize Window To Image" IsCheckable="True" IsChecked="True" Checked="OnMnuResizeWindowChecked" Unchecked="OnMnuResizeWindowChecked" />
|
||||
<MenuItem x:Name="mnuFitImage" Header="Fit Image To Window" IsCheckable="True" IsChecked="True" Checked="OnMnuFitImageChecked" Unchecked="OnMnuFitImageChecked" />
|
||||
<MenuItem x:Name="mnuShowQueue" Header="Show Queue" IsCheckable="True" IsChecked="True" Checked="OnMnuShowQueueChecked" Unchecked="OnMnuShowQueueChecked" />
|
||||
</MenuItem>
|
||||
<MenuItem Header="Help">
|
||||
<MenuItem Header="About" Click="About_Clicked">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources/Question_16x.png"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<ToolBarTray DockPanel.Dock="Top" Orientation="Horizontal">
|
||||
<ToolBar>
|
||||
<Button Click="OpenFiles_Clicked" ToolTip="Open Files">
|
||||
<Button.Content>
|
||||
<Image Source="Resources/OpenFolder.ico" Width="16" Height="16"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Click="LoadURL_Clicked" ToolTip="Open URL">
|
||||
<Button.Content>
|
||||
<Image Source="Resources/Web.ico" Width="16" Height="16"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Separator/>
|
||||
<CheckBox x:Name="chkResizeWindow" ToolTip="Fit to window" IsChecked="True" Checked="OnChkResizeWindowChecked" Unchecked="OnChkResizeWindowChecked">
|
||||
<CheckBox.Content>
|
||||
<Image Source="Resources/ResizableControl_16x.png"/>
|
||||
</CheckBox.Content>
|
||||
</CheckBox>
|
||||
<CheckBox x:Name="chkFitToWindow" IsChecked="True" Checked="OnChkFitToWindowChecked" Unchecked="OnChkFitToWindowChecked" ToolTip="Contain Image In Window">
|
||||
<CheckBox.Content>
|
||||
<Image Source="Resources/FitToScreen_16x.png"/>
|
||||
</CheckBox.Content>
|
||||
</CheckBox>
|
||||
<CheckBox x:Name="chkShowQueue" ToolTip="Show Queue Sidebar" IsChecked="True" Checked="OnShowQueueChecked" Unchecked="OnShowQueueChecked">
|
||||
<CheckBox.Content>
|
||||
<Image Source="Resources/ShowDetailsPane_16x.png"/>
|
||||
</CheckBox.Content>
|
||||
</CheckBox>
|
||||
<Separator/>
|
||||
<Button x:Name="btnClear" Click="ClearQueue_Clicked" ToolTip="Clear Queue" IsEnabled="False">
|
||||
<Button.Content>
|
||||
<Image Source="Resources/CleanData_16x.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Separator/>
|
||||
<Button x:Name="btnStart" Click="Start_Clicked" ToolTip="Play" IsEnabled="False">
|
||||
<Button.Content>
|
||||
<Image Source="Resources/Run.ico" Width="16" Height="16"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button x:Name="btnPause" Click="Pause_Clicked" ToolTip="Pause" IsEnabled="False" Margin="0,0,0,2" VerticalAlignment="Bottom">
|
||||
<Button.Content>
|
||||
<Image Source="Resources/Pause.ico" Width="16" Height="16"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button x:Name="btnPrev" Click="Previous_Clicked" ToolTip="Previous" IsEnabled="False">
|
||||
<Button.Content>
|
||||
<Image Source="Resources/Previous.ico" Width="16" Height="16"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button x:Name="btnNext" Click="Next_Clicked" IsEnabled="False">
|
||||
<Button.Content>
|
||||
<Image Source="Resources/Next_16x.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
<StatusBar DockPanel.Dock="Bottom" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Panel.ZIndex="1">
|
||||
<StatusBarItem>
|
||||
<TextBlock x:Name="statusText" TextTrimming="CharacterEllipsis" FlowDirection="RightToLeft" HorizontalAlignment="Right">
|
||||
Ready
|
||||
</TextBlock>
|
||||
</StatusBarItem>
|
||||
<StatusBarItem HorizontalAlignment="Right" VerticalContentAlignment="Center">
|
||||
<ProgressBar x:Name="progressBar" Width="50" Height="15" Maximum="1000"/>
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
<Grid Drop="ImgMain_Drop">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition x:Name="colQueue" Width="140" MinWidth="50" MaxWidth="300" />
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<DockPanel x:Name="queueSidebar" Grid.Column="0" AllowDrop="True">
|
||||
<TextBlock DockPanel.Dock="Top" HorizontalAlignment="Center" Padding="2" Drop="ImgMain_Drop" AllowDrop="True">
|
||||
Queue
|
||||
</TextBlock>
|
||||
<Border DockPanel.Dock="Top" Background="LightGray" Height="1" Drop="ImgMain_Drop"/>
|
||||
<ScrollViewer x:Name="queueScroll" CanContentScroll="True" AllowDrop="True" VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl x:Name="imageQueue"/>
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
<GridSplitter x:Name="colSplitter" Grid.Column="1" HorizontalAlignment="Center" Width="1" Background="Beige" />
|
||||
<DockPanel x:Name="imgContainer" Grid.Column="2" Background="Transparent" AllowDrop="True">
|
||||
<Canvas x:Name="canvas" SizeChanged="OnCanvasResize" >
|
||||
<Image x:Name="imgMain" Source="Resources/Image.ico" AllowDrop="True" Stretch="None"/>
|
||||
</Canvas>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</Window>
|
410
PictureViewer/MainWindow.xaml.cs
Normal file
|
@ -0,0 +1,410 @@
|
|||
/**
|
||||
* Picture Viewer
|
||||
* Neil Brommer
|
||||
*
|
||||
* Note: the window will not resize itself to the full size of large images.
|
||||
* This is due to Windows preventing the window from growing too large.
|
||||
*/
|
||||
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Threading;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
namespace PictureViewer {
|
||||
public partial class MainWindow : Window {
|
||||
private List<String> queue;
|
||||
private int curImage;
|
||||
private double delayTime;
|
||||
private String tempDir;
|
||||
private DispatcherTimer timer;
|
||||
private GridLength sidebarWidth;
|
||||
private int nextImage;
|
||||
private TimeSpan animationDuration;
|
||||
|
||||
public MainWindow() {
|
||||
InitializeComponent();
|
||||
queue = new List<String>();
|
||||
curImage = -1;
|
||||
delayTime = 5.0;
|
||||
tempDir = Environment.GetEnvironmentVariable("TEMP");
|
||||
timer = new DispatcherTimer {
|
||||
Interval = new TimeSpan(0, 0, 1)
|
||||
};
|
||||
timer.Tick += Timer_Tick;
|
||||
this.sidebarWidth = this.colQueue.Width; // initialize it just in case
|
||||
this.nextImage = -1;
|
||||
animationDuration = TimeSpan.FromSeconds(0.25);
|
||||
}
|
||||
|
||||
private void ImgMain_Drop(object sender, DragEventArgs e) {
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop)) {
|
||||
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
|
||||
AddFiles(files);
|
||||
} else if (e.Data.GetDataPresent(DataFormats.Text)) {
|
||||
string url = (String)e.Data.GetData(DataFormats.Text);
|
||||
AddURL(url);
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenFiles_Clicked(object sender, RoutedEventArgs e) {
|
||||
OpenFileDialog dlg = new OpenFileDialog {
|
||||
Title = "Open Images",
|
||||
Multiselect = true,
|
||||
DefaultExt = ".png",
|
||||
Filter = "Image Files|*.jpeg;*.jpg;*.png;*.gif;*.bmp;*.ico|All files (*.*)|*.*"
|
||||
};
|
||||
bool? res = dlg.ShowDialog();
|
||||
|
||||
if (res != null && res == true) {
|
||||
AddFiles(dlg.FileNames);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadURL_Clicked(object sender, RoutedEventArgs e) {
|
||||
AddImageURL dlg = new AddImageURL();
|
||||
dlg.ShowDialog();
|
||||
Uri address = dlg.Address;
|
||||
|
||||
if (address != null)
|
||||
AddURL(address.AbsoluteUri);
|
||||
}
|
||||
|
||||
private void Start_Clicked(object sender, RoutedEventArgs e) {
|
||||
if (queue.Count > 0 && curImage < queue.Count - 1) {
|
||||
timer.Start();
|
||||
btnStart.IsEnabled = false;
|
||||
btnPause.IsEnabled = true;
|
||||
} else
|
||||
MessageBox.Show("Finished Queue", "Finished");
|
||||
}
|
||||
|
||||
private void Pause_Clicked(object sender, RoutedEventArgs e) {
|
||||
timer.Stop();
|
||||
btnPause.IsEnabled = false;
|
||||
btnStart.IsEnabled = true;
|
||||
}
|
||||
|
||||
private void Timer_Tick(object sender, EventArgs e) {
|
||||
progressBar.Value = progressBar.Value + (1.0 / delayTime * 1000);
|
||||
if (progressBar.Value == progressBar.Maximum) {
|
||||
Next_Clicked(null, null);
|
||||
progressBar.Value = 0;
|
||||
|
||||
if (curImage == queue.Count - 2)
|
||||
Pause_Clicked(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearQueue_Clicked(object sender, RoutedEventArgs e) {
|
||||
imageQueue.Items.Clear();
|
||||
queue.Clear();
|
||||
EnableUI(false);
|
||||
|
||||
this.SizeToContent = SizeToContent.Manual;
|
||||
if (this.chkResizeWindow.IsChecked == true) {
|
||||
this.Width = 500;
|
||||
this.Height = 350;
|
||||
}
|
||||
|
||||
imgMain.Source = new BitmapImage(new Uri("pack://application:,,,/PictureViewer;component/Resources/image.ico", UriKind.Absolute));
|
||||
imgMain.Stretch = Stretch.None;
|
||||
curImage = -1;
|
||||
|
||||
if (timer.IsEnabled) {
|
||||
timer.Stop();
|
||||
progressBar.Value = 0;
|
||||
}
|
||||
|
||||
SetStatus("Ready");
|
||||
}
|
||||
|
||||
private void Previous_Clicked(object sender, RoutedEventArgs e) {
|
||||
if (curImage > 0 && curImage < queue.Count) {
|
||||
SetImage(curImage - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void Next_Clicked(object sender, RoutedEventArgs e) {
|
||||
if (curImage < queue.Count - 1 && curImage >= 0) {
|
||||
SetImage(curImage + 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void ImageQueue_Clicked(object sender, RoutedEventArgs e) {
|
||||
int index = imageQueue.Items.IndexOf((UIElement)((Image)sender).Parent);
|
||||
SetImage(index);
|
||||
}
|
||||
|
||||
private void SetImage(int index) {
|
||||
if (index >= imageQueue.Items.Count || index < 0)
|
||||
throw new IndexOutOfRangeException("index given to SetImage is out of range");
|
||||
|
||||
this.nextImage = index;
|
||||
|
||||
// fade the current image out
|
||||
DoubleAnimation animation = new DoubleAnimation(1, 0, this.animationDuration);
|
||||
animation.Completed += SetNewImage;
|
||||
this.canvas.BeginAnimation(Image.OpacityProperty, animation);
|
||||
}
|
||||
|
||||
private void SetNewImage(object sender, EventArgs e) {
|
||||
// set the new image
|
||||
BitmapImage newMain = null;
|
||||
try {
|
||||
newMain = new BitmapImage(new Uri(queue[this.nextImage]));
|
||||
} catch (FileNotFoundException ex) {
|
||||
MessageBox.Show("File bot found: " + ex.FileName, "File Not Found", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
|
||||
if (newMain == null) {
|
||||
RemoveImage(this.nextImage);
|
||||
return;
|
||||
}
|
||||
|
||||
imgMain.Source = newMain;
|
||||
|
||||
// deselect the old thumbnail in the queue
|
||||
StackPanel thumb;
|
||||
if (curImage != -1) {
|
||||
thumb = (StackPanel)imageQueue.Items[curImage];
|
||||
thumb.Background = Brushes.Transparent;
|
||||
}
|
||||
|
||||
this.curImage = this.nextImage;
|
||||
|
||||
// select the new thumbnail in the queue
|
||||
thumb = (StackPanel)this.imageQueue.Items[this.curImage];
|
||||
thumb.Background = SystemColors.HighlightBrush;
|
||||
|
||||
SetStatus(queue[this.curImage]);
|
||||
|
||||
// size window or image to show the full image
|
||||
if (this.chkResizeWindow.IsChecked == true) {
|
||||
double windowExtrasX = this.ActualWidth - this.canvas.ActualWidth;
|
||||
double windowExtrasY = this.ActualHeight - this.canvas.ActualHeight;
|
||||
|
||||
this.Width = windowExtrasX + newMain.Width;
|
||||
this.Height = windowExtrasY + newMain.Height;
|
||||
|
||||
Console.WriteLine("WindowX: " + this.ActualWidth + ", WindowY: " + this.ActualHeight);
|
||||
Console.WriteLine("ImageX: " + newMain.Width + ", ImageY: " + newMain.Height);
|
||||
Console.WriteLine();
|
||||
} else {
|
||||
if (this.chkFitToWindow.IsChecked == true)
|
||||
this.OnCanvasResize(null, null); // fit the image to the window
|
||||
}
|
||||
|
||||
// scroll the current thumbnail into view
|
||||
if (imageQueue.ItemContainerGenerator.ContainerFromIndex(curImage) is FrameworkElement container) {
|
||||
container.BringIntoView();
|
||||
}
|
||||
|
||||
// fade the new image in
|
||||
DoubleAnimation animation = new DoubleAnimation(0, 1, this.animationDuration);
|
||||
this.canvas.BeginAnimation(Image.OpacityProperty, animation);
|
||||
}
|
||||
|
||||
private void RemoveImage_Clicked(object sender, RoutedEventArgs e) {
|
||||
if (sender is MenuItem mnu) {
|
||||
Image img = ((ContextMenu)mnu.Parent).PlacementTarget as Image;
|
||||
int index = imageQueue.Items.IndexOf(img);
|
||||
this.RemoveImage(index);
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveImage(int index) {
|
||||
if (index == curImage || curImage > index)
|
||||
curImage--;
|
||||
|
||||
imageQueue.Items.RemoveAt(index);
|
||||
queue.RemoveAt(index);
|
||||
|
||||
if (queue.Count == 0)
|
||||
ClearQueue_Clicked(null, null);
|
||||
else
|
||||
SetImage(curImage);
|
||||
}
|
||||
|
||||
private void AddFiles(string[] files) {
|
||||
foreach (String filename in files) {
|
||||
try {
|
||||
StackPanel panel = new StackPanel();
|
||||
Image img = new Image();
|
||||
BitmapImage bi = new BitmapImage();
|
||||
bi.BeginInit();
|
||||
bi.CacheOption = BitmapCacheOption.OnLoad;
|
||||
bi.DecodePixelWidth = 300;
|
||||
bi.UriSource = new Uri(filename);
|
||||
bi.EndInit();
|
||||
img.Source = bi;
|
||||
img.Stretch = Stretch.Uniform;
|
||||
if (queue.Count == 0)
|
||||
img.Margin = new Thickness(5, 5, 5, 5);
|
||||
else
|
||||
img.Margin = new Thickness(5, 5, 5, 5);
|
||||
img.MouseLeftButtonUp += ImageQueue_Clicked;
|
||||
img.ContextMenu = this.Resources["imageMenu"] as ContextMenu;
|
||||
panel.Children.Add(img);
|
||||
imageQueue.Items.Add(panel);
|
||||
queue.Add(filename);
|
||||
} catch (NotSupportedException) {
|
||||
MessageBox.Show(filename + " is not in a supported format", "Invalid Format", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
} catch (FileNotFoundException) {
|
||||
MessageBox.Show(filename + " was not found", "File Not Found", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
if (imageQueue.Items.Count > 0 && curImage == -1) {
|
||||
SetImage(0);
|
||||
imgMain.Stretch = Stretch.Uniform;
|
||||
EnableUI(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddURL(string url) {
|
||||
bool res = Uri.TryCreate(url, UriKind.Absolute, out Uri address)
|
||||
&& (address.Scheme == Uri.UriSchemeHttp
|
||||
|| address.Scheme == Uri.UriSchemeHttps);
|
||||
|
||||
if (res) {
|
||||
String localPath = Path.Combine(tempDir, Path.GetFileName(address.LocalPath));
|
||||
|
||||
Console.WriteLine("Got this far");
|
||||
|
||||
WebClient client = new WebClient();
|
||||
try {
|
||||
client.DownloadFile(address, localPath);
|
||||
AddFiles(new string[] { localPath });
|
||||
} catch (WebException ex) {
|
||||
MessageBox.Show("Error loading image:\n" + ex.Message, "Error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void EnableUI(bool en) {
|
||||
btnClear.IsEnabled = en;
|
||||
btnStart.IsEnabled = en;
|
||||
btnPrev.IsEnabled = en;
|
||||
btnNext.IsEnabled = en;
|
||||
|
||||
mnuClear.IsEnabled = en;
|
||||
mnuStart.IsEnabled = en;
|
||||
mnuPrev.IsEnabled = en;
|
||||
mnuNext.IsEnabled = en;
|
||||
|
||||
if (!en) { // don't automatically enable these
|
||||
btnPause.IsEnabled = false;
|
||||
mnuPause.IsEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetImageToActualSize() {
|
||||
this.imgMain.Width = Double.NaN; // set to auto
|
||||
this.imgMain.Height = Double.NaN;
|
||||
|
||||
this.canvas.Width = Double.NaN;
|
||||
this.canvas.Height = Double.NaN;
|
||||
}
|
||||
|
||||
private void SetStatus(string status) {
|
||||
statusText.Text = status;
|
||||
}
|
||||
|
||||
private void About_Clicked(object sender, RoutedEventArgs e) {
|
||||
AboutWindow abt = new AboutWindow();
|
||||
abt.Show();
|
||||
}
|
||||
|
||||
private void Exit_Clicked(object sender, RoutedEventArgs e) {
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void OnShowQueueChecked(object sender, RoutedEventArgs e) {
|
||||
if (this.IsLoaded) {
|
||||
if (this.chkShowQueue.IsChecked == true) {
|
||||
this.mnuShowQueue.IsChecked = true;
|
||||
this.queueSidebar.Visibility = Visibility.Visible;
|
||||
this.colQueue.Width = sidebarWidth;
|
||||
this.colQueue.MinWidth = 50;
|
||||
this.colSplitter.IsEnabled = true;
|
||||
} else {
|
||||
this.mnuShowQueue.IsChecked = false;
|
||||
this.sidebarWidth = this.colQueue.Width;
|
||||
this.colQueue.MinWidth = 0;
|
||||
this.colSplitter.IsEnabled = false;
|
||||
this.queueSidebar.Visibility = Visibility.Collapsed;
|
||||
this.colQueue.Width = new GridLength(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCanvasResize(object sender, SizeChangedEventArgs e) {
|
||||
// TODO scale the canvas/image to fit the window
|
||||
this.imgMain.Width = this.canvas.ActualWidth;
|
||||
this.imgMain.Height = this.canvas.ActualHeight;
|
||||
}
|
||||
|
||||
private void OnChkFitToWindowChecked(object sender, RoutedEventArgs e) {
|
||||
if (this.IsLoaded) {
|
||||
if (this.chkFitToWindow.IsChecked == true) {
|
||||
this.mnuFitImage.IsChecked = true;
|
||||
this.canvas.SizeChanged += OnCanvasResize;
|
||||
this.OnCanvasResize(null, null);
|
||||
} else {
|
||||
this.mnuFitImage.IsChecked = false;
|
||||
this.canvas.SizeChanged -= OnCanvasResize;
|
||||
this.SetImageToActualSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnChkResizeWindowChecked(object sender, RoutedEventArgs e) {
|
||||
if (this.IsLoaded) {
|
||||
if (this.chkResizeWindow.IsChecked == true)
|
||||
this.mnuResizeWindow.IsChecked = true;
|
||||
else
|
||||
this.mnuResizeWindow.IsChecked = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMnuResizeWindowChecked(object sender, RoutedEventArgs e) {
|
||||
if (this.IsLoaded)
|
||||
this.chkResizeWindow.IsChecked = this.mnuResizeWindow.IsChecked;
|
||||
}
|
||||
|
||||
private void OnMnuFitImageChecked(object sender, RoutedEventArgs e) {
|
||||
if (this.IsLoaded)
|
||||
this.chkFitToWindow.IsChecked = this.mnuFitImage.IsChecked;
|
||||
}
|
||||
|
||||
private void OnMnuShowQueueChecked(object sender, RoutedEventArgs e) {
|
||||
if (this.IsLoaded)
|
||||
this.chkShowQueue.IsChecked = this.mnuShowQueue.IsChecked;
|
||||
}
|
||||
|
||||
private void OnChangeAnimLength_Clicked(object sender, RoutedEventArgs e) {
|
||||
AskForTime ask = new AskForTime(this.animationDuration.TotalSeconds, "Animation", "double");
|
||||
ask.ShowDialog();
|
||||
if (ask.DialogResult == true) {
|
||||
this.animationDuration = TimeSpan.FromSeconds(ask.time);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnChangeSlideDelay_Clicked(object sender, RoutedEventArgs e) {
|
||||
AskForTime ask = new AskForTime(this.delayTime, "Slide Delay", "int");
|
||||
ask.ShowDialog();
|
||||
if (ask.DialogResult == true) {
|
||||
this.delayTime = ask.time;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
203
PictureViewer/PictureViewer.csproj
Normal file
|
@ -0,0 +1,203 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{8A346D98-6813-4ECF-B7D4-99A61FC2310D}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>PictureViewer</RootNamespace>
|
||||
<AssemblyName>PictureViewer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="AddImageURL.xaml.cs">
|
||||
<DependentUpon>AddImageURL.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="AboutWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="AskForTime.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="AboutWindow.xaml.cs">
|
||||
<DependentUpon>AboutWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="AskForTime.xaml.cs">
|
||||
<DependentUpon>AskForTime.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="AddImageURL.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Image.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Question_16x.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Close_16x.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\OpenFolder.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Pause.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Run.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Stop.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Web.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\CleanData_16x.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Next_16x.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Previous.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\FitToScreen_16x.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\ClearWindowContent_16x.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\ResizableControl_16x.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\ShowDetailsPane_16x.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Time.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\TransitioningContentControl_16x.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
61
PictureViewer/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,61 @@
|
|||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Picture Viewer")]
|
||||
[assembly: AssemblyDescription(
|
||||
"Features:\n" +
|
||||
"Slideshow with adjustable delay\n" +
|
||||
"Queue sidebar\n" +
|
||||
"Drag and drop files and urls\n" +
|
||||
"Enable/disable window autoresizing\n" +
|
||||
"Enable/disable fit image to window")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("PictureViewer")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[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)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
62
PictureViewer/Properties/Resources.Designer.cs
generated
Normal file
|
@ -0,0 +1,62 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace PictureViewer.Properties {
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if ((resourceMan == null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PictureViewer.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
117
PictureViewer/Properties/Resources.resx
Normal file
|
@ -0,0 +1,117 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
26
PictureViewer/Properties/Settings.Designer.cs
generated
Normal file
|
@ -0,0 +1,26 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace PictureViewer.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
PictureViewer/Properties/Settings.settings
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
BIN
PictureViewer/Resources/CleanData_16x.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
PictureViewer/Resources/ClearWindowContent_16x.png
Normal file
After Width: | Height: | Size: 320 B |
BIN
PictureViewer/Resources/Close_16x.png
Normal file
After Width: | Height: | Size: 235 B |
BIN
PictureViewer/Resources/FitToScreen_16x.png
Normal file
After Width: | Height: | Size: 206 B |
BIN
PictureViewer/Resources/Image.ico
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
PictureViewer/Resources/Next_16x.png
Normal file
After Width: | Height: | Size: 274 B |
BIN
PictureViewer/Resources/OpenFolder.ico
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
PictureViewer/Resources/Pause.ico
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
PictureViewer/Resources/Previous.ico
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
PictureViewer/Resources/Question_16x.png
Normal file
After Width: | Height: | Size: 207 B |
BIN
PictureViewer/Resources/ResizableControl_16x.png
Normal file
After Width: | Height: | Size: 158 B |
BIN
PictureViewer/Resources/Run.ico
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
PictureViewer/Resources/ShowDetailsPane_16x.png
Normal file
After Width: | Height: | Size: 143 B |
BIN
PictureViewer/Resources/Stop.ico
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
PictureViewer/Resources/Time.ico
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
PictureViewer/Resources/TransitioningContentControl_16x.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
PictureViewer/Resources/Web.ico
Normal file
After Width: | Height: | Size: 55 KiB |