Skip to content
This repository has been archived by the owner on Jun 1, 2021. It is now read-only.

Commit

Permalink
Prettier, with icons
Browse files Browse the repository at this point in the history
git-svn-id: svn://localhost/WellCompareDir/trunk@993 e549bf12-f090-ff4b-a60d-830663ca835f
  • Loading branch information
joelpurra committed Nov 18, 2010
1 parent a94b908 commit ff7bfce
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 17 deletions.
Binary file added WellCompareDir.WPF/Images/folder.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WellCompareDir.WPF/Images/pictures.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions WellCompareDir.WPF/Images/silk icons.txt
@@ -0,0 +1,4 @@
Using Silk Icons from famfamfam.com
http://www.famfamfam.com/lab/icons/silk/

A big thank you goes out to Mark James in Birmingham, UK
43 changes: 26 additions & 17 deletions WellCompareDir.WPF/MainWindowView.xaml
Expand Up @@ -6,7 +6,9 @@
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:Comparer="clr-namespace:WellCompareDir.Comparer;assembly=WellCompareDir.Comparer"
xmlns:local="clr-namespace:WellCompareDir.WPF"
Title="WellCompareDir" Width="750" Height="550" WindowStartupLocation="CenterScreen" WindowState="Maximized">
Title="WellCompareDir by Joel Purra"
Width="750" Height="550" WindowStartupLocation="CenterScreen" WindowState="Maximized"
Icon="/WellCompareDir.WPF;component/Images/pictures.png">

<i:Interaction.Behaviors>
<Framework:AutoWireUpViewModelBehavior />
Expand Down Expand Up @@ -36,16 +38,13 @@
</Window.Resources>

<DockPanel Margin="10">

<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal">
<StackPanel.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="Margin" Value="5,5,5,5" />
</Style>
</StackPanel.Resources>
</StackPanel>

<ComboBox IsEditable="True" Grid.Row="0" Grid.Column="0" Margin="0,5,0,0" Text="{Binding OutputDirectoryPath}" DockPanel.Dock="Bottom"/>
<DockPanel DockPanel.Dock="Bottom" Margin="0,5,0,0">
<Label Content="Output:" />
<Button Command="{Binding BrowseForOutputDirectoryCommand}" DockPanel.Dock="Right" Padding="3,0">
<Image Source="/WellCompareDir.WPF;component/Images/folder.png" Stretch="None" />
</Button>
<Label Content="{Binding OutputDirectoryPath}" />
</DockPanel>

<Grid Height="Auto" DockPanel.Dock="Top">
<Grid.RowDefinitions>
Expand All @@ -65,8 +64,18 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>

<ComboBox IsEditable="True" Grid.Row="0" Grid.Column="0" Text="{Binding LeftDirectoryPath}" />
<ComboBox IsEditable="True" Grid.Row="0" Grid.Column="2" Text="{Binding RightDirectoryPath}" />
<DockPanel Grid.Row="0" Grid.Column="0">
<Label Content="Left:" />
<Button Command="{Binding BrowseForLeftDirectoryCommand}" DockPanel.Dock="Right" Padding="3,0"><Image Source="/WellCompareDir.WPF;component/Images/folder.png" Stretch="None" /></Button>
<Label Content="{Binding LeftDirectoryPath}" />
</DockPanel>
<DockPanel Grid.Row="0" Grid.Column="2">
<Label Content="Right:" />
<Button Command="{Binding BrowseForRightDirectoryCommand}" DockPanel.Dock="Right" Padding="3,0">
<Image Source="/WellCompareDir.WPF;component/Images/folder.png" Stretch="None" />
</Button>
<Label Content="{Binding RightDirectoryPath}" />
</DockPanel>

<ListBox Name="leftFiles" Grid.Row="2" Grid.Column="0"
ItemsSource="{Binding LeftFiles}"
Expand All @@ -93,9 +102,9 @@
<RowDefinition />
</Grid.RowDefinitions>

<Label Grid.Row="0" Grid.Column="0">Dimensions</Label>
<Label Grid.Row="0" Grid.Column="0">Dimensions:</Label>
<Label Grid.Row="0" Grid.Column="1" Content="{Binding LeftImageDimensions}"/>
<Label Grid.Row="0" Grid.Column="2">Size</Label>
<Label Grid.Row="0" Grid.Column="2">Size:</Label>
<Label Grid.Row="0" Grid.Column="3" Content="{Binding LeftFileSize}"/>
</Grid>

Expand All @@ -110,9 +119,9 @@
<RowDefinition />
</Grid.RowDefinitions>

<Label Grid.Row="0" Grid.Column="0">Dimensions</Label>
<Label Grid.Row="0" Grid.Column="0">Dimensions:</Label>
<Label Grid.Row="0" Grid.Column="1" Content="{Binding RightImageDimensions}"/>
<Label Grid.Row="0" Grid.Column="2">Size</Label>
<Label Grid.Row="0" Grid.Column="2">Size:</Label>
<Label Grid.Row="0" Grid.Column="3" Content="{Binding RightFileSize}"/>
</Grid>

Expand Down
79 changes: 79 additions & 0 deletions WellCompareDir.WPF/MainWindowViewModel.cs
Expand Up @@ -10,6 +10,7 @@
using WellCompareDir.Comparer;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;

namespace WellCompareDir.WPF
{
Expand Down Expand Up @@ -610,12 +611,57 @@ public RelayCommand UseRightFileCommand
}
}

RelayCommand browseForOutputDirectoryCommand;
public RelayCommand BrowseForOutputDirectoryCommand
{
get
{
return this.browseForOutputDirectoryCommand;
}
set
{
this.browseForOutputDirectoryCommand = value;
this.OnPropertyChanged("BrowseForOutputDirectoryCommand");
}
}

RelayCommand browseForLeftDirectoryCommand;
public RelayCommand BrowseForLeftDirectoryCommand
{
get
{
return this.browseForLeftDirectoryCommand;
}
set
{
this.browseForLeftDirectoryCommand = value;
this.OnPropertyChanged("BrowseForLeftDirectoryCommand");
}
}

RelayCommand browseForRightDirectoryCommand;
public RelayCommand BrowseForRightDirectoryCommand
{
get
{
return this.browseForRightDirectoryCommand;
}
set
{
this.browseForRightDirectoryCommand = value;
this.OnPropertyChanged("BrowseForRightDirectoryCommand");
}
}

private void InitCommands()
{
PreviousFileCommand = new RelayCommand(PreviousFile, CanPreviousFile);
NextFileCommand = new RelayCommand(NextFile, CanNextFile);
UseLeftFileCommand = new RelayCommand(UseLeftFile, CanUseLeftFile);
UseRightFileCommand = new RelayCommand(UseRightFile, CanUseRightFile);
BrowseForOutputDirectoryCommand = new RelayCommand(BrowseForOutputDirectory);
BrowseForLeftDirectoryCommand = new RelayCommand(BrowseForLeftDirectory);
BrowseForRightDirectoryCommand = new RelayCommand(BrowseForRightDirectory);
}
#endregion

Expand Down Expand Up @@ -679,6 +725,39 @@ private string GetImageDimensions(ref BitmapImage image)
{
return String.Format("{0}x{1}px ({2}x{3} dpi)", image.PixelWidth, image.PixelHeight, image.DpiX, image.DpiY);
}

public string BrowseForFolder(string start)
{
string selected = null;

FolderBrowserDialog dlg = new FolderBrowserDialog();

//dlg.Description = "Browse for folder";

dlg.SelectedPath = start;

if (dlg.ShowDialog() == DialogResult.OK)
{
selected = dlg.SelectedPath;
}

return selected;
}

public void BrowseForOutputDirectory(object parameter)
{
this.OutputDirectoryPath = this.BrowseForFolder(this.OutputDirectoryPath) ?? this.OutputDirectoryPath;
}

public void BrowseForLeftDirectory(object parameter)
{
this.LeftDirectoryPath = this.BrowseForFolder(this.LeftDirectoryPath) ?? this.LeftDirectoryPath;
}

public void BrowseForRightDirectory(object parameter)
{
this.RightDirectoryPath = this.BrowseForFolder(this.RightDirectoryPath) ?? this.RightDirectoryPath;
}
#endregion
}
}
16 changes: 16 additions & 0 deletions WellCompareDir.WPF/WellCompareDir.WPF.csproj
Expand Up @@ -35,12 +35,16 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>pictures.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Framework">
<HintPath>..\References\NakedMVVM\Framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Interactivity">
<HintPath>..\References\NakedMVVM\System.Windows.Interactivity.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -109,6 +113,18 @@
<Name>WellCompareDir.Comparer</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\folder.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\pictures.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="pictures.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\silk icons.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
Binary file added WellCompareDir.WPF/pictures.ico
Binary file not shown.

0 comments on commit ff7bfce

Please sign in to comment.