Skip to content

Commit

Permalink
Added some refinement to the app branding and added the about dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
mhmd-azeez committed Nov 12, 2016
1 parent 263d051 commit d0696c2
Show file tree
Hide file tree
Showing 13 changed files with 244 additions and 36 deletions.
2 changes: 2 additions & 0 deletions RudeFox.FrontEnd/Helpers/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ class Constants
public const int KILOBYTE = 1024;
public const int MEGABYTE = KILOBYTE * KILOBYTE;
public const int GIGABYTE = MEGABYTE * KILOBYTE;

public const string WEBSITE_URL = "https://github.com/encrypt0r/RudeFox";
}
}
4 changes: 2 additions & 2 deletions RudeFox.FrontEnd/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// 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("RudeFox.FrontEnd")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("Rude Fox")]
[assembly: AssemblyDescription("A simple file sanitizer")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RudeFox.FrontEnd")]
Expand Down
23 changes: 21 additions & 2 deletions RudeFox.FrontEnd/RudeFox.FrontEnd.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Images\icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="GongSolutions.Wpf.DragDrop, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\gong-wpf-dragdrop.1.0.0\lib\net45\GongSolutions.Wpf.DragDrop.dll</HintPath>
Expand Down Expand Up @@ -66,9 +69,14 @@
</Compile>
<Compile Include="Helpers\Constants.cs" />
<Compile Include="Models\ItemType.cs" />
<Compile Include="Services\DialogService.cs" />
<Compile Include="Services\ShredderService.cs" />
<Compile Include="ViewModels\AboutDialogVM.cs" />
<Compile Include="ViewModels\MainWindowVM.cs" />
<Compile Include="ViewModels\WorkItemVM.cs" />
<Compile Include="Views\AboutDialog.xaml.cs">
<DependentUpon>AboutDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Views\MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -104,14 +112,25 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Page Include="Views\AboutDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\MainWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Resource Include="images\file.png" />
<Resource Include="images\folder.png" />
<Resource Include="Images\file.png" />
<Resource Include="Images\folder.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\icon.ico" />
<Resource Include="Images\icon_24.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\icon_128.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
36 changes: 36 additions & 0 deletions RudeFox.FrontEnd/Services/DialogService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using RudeFox.Views;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace RudeFox.Services
{
public class DialogService
{
#region Constructor
private DialogService()
{

}
#endregion

#region Properties
private static DialogService _instance;
public static DialogService Instance
{
get { return _instance ?? (_instance = new DialogService()); }
}
#endregion

#region Methods
public bool? OpenAboutDialog()
{
var window = new AboutDialog();
return window.ShowDialog();
}
#endregion
}
}
38 changes: 38 additions & 0 deletions RudeFox.FrontEnd/ViewModels/AboutDialogVM.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using RudeFox.Helpers;
using RudeFox.Mvvm;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace RudeFox.ViewModels
{
class AboutDialogVM : BindableBase
{
#region Constructor
public AboutDialogVM()
{
VisitWebsiteCommand = new DelegateCommand(p => Process.Start(Constants.WEBSITE_URL));
}
#endregion

#region Properties
public string Version
{
get
{
var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
// return "VERSION " + version.Major.ToString() + "." + version.Minor.ToString();
return "VERSION " + version.ToString();
}
}
#endregion

#region Commands
public ICommand VisitWebsiteCommand { get; private set; }
#endregion
}
}
10 changes: 9 additions & 1 deletion RudeFox.FrontEnd/ViewModels/MainWindowVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class MainWindowVM : BindableBase, IDropTarget
#region Constructor
public MainWindowVM()
{

ShowAboutCommand = new DelegateCommand(p => DialogService.Instance.OpenAboutDialog());
ExitCommand = new DelegateCommand(p => Application.Current.Shutdown());
}
#endregion

Expand All @@ -36,6 +37,13 @@ public ObservableCollection<WorkItemVM> WorkItems
get { return _workItems; }
set { SetProperty(ref _workItems, value); }
}

public string Title { get { return "Rude Fox"; } }
#endregion

#region Commands
public ICommand ShowAboutCommand { get; private set; }
public ICommand ExitCommand { get; private set; }
#endregion

#region Drag and drop
Expand Down
2 changes: 1 addition & 1 deletion RudeFox.FrontEnd/ViewModels/WorkItemVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public long Bytes

public string Image
{
get { return "pack://application:,,,/images/" + Type.ToString().ToLower() + ".png"; }
get { return "pack://application:,,,/Images/" + Type.ToString().ToLower() + ".png"; }
}

public string Size
Expand Down
35 changes: 35 additions & 0 deletions RudeFox.FrontEnd/Views/AboutDialog.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<Window x:Class="RudeFox.Views.AboutDialog"
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:RudeFox.Views" WindowStyle="SingleBorderWindow" ResizeMode="NoResize"
mc:Ignorable="d" Icon="/Images/icon_24.png" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
Title="About Rude Fox" Height="300" Width="500">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="8*"/>
<RowDefinition Height="2*"/>
</Grid.RowDefinitions>

<Image Source="/Images/icon_128.png" VerticalAlignment="Center" HorizontalAlignment="Center" Width="96" Stretch="Uniform"/>

<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" >
<TextBlock Text="Rude Fox" FontWeight="Light" FontSize="32" />
<TextBlock Text="{Binding Version}" FontSize="12" Foreground="#555" Margin="0,0,0,10" />
<TextBlock Text="Programming:" FontSize="14" />
<TextBlock Text="Encryptor (encryptor@outlook.com)"/>
<TextBlock Text="Icons by:" FontSize="14" Margin="0,10,0,0"/>
<TextBlock Text="Madebyoliver and Flat Icons"/>
</StackPanel>

<StackPanel VerticalAlignment="Center" Orientation="Horizontal" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Margin="10,0">
<Button x:Name="websiteButton" Content="Visit our website" Padding="10, 5" Command="{Binding VisitWebsiteCommand}"/>
<Button x:Name="closeButton" Content="Close" Margin="10,0,0,0" Padding="10, 5" IsCancel="True" />
</StackPanel>
</Grid>
</Window>
30 changes: 30 additions & 0 deletions RudeFox.FrontEnd/Views/AboutDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using RudeFox.ViewModels;
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.Shapes;

namespace RudeFox.Views
{
/// <summary>
/// Interaction logic for AboutDialog.xaml
/// </summary>
public partial class AboutDialog : Window
{
public AboutDialog()
{
InitializeComponent();

DataContext = new AboutDialogVM();
}
}
}
100 changes: 70 additions & 30 deletions RudeFox.FrontEnd/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,80 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:RudeFox.Views"
mc:Ignorable="d"
xmlns:vm="clr-namespace:RudeFox.ViewModels"
xmlns:gong="urn:gong-wpf-dragdrop"
Title="Rude Fox" Height="300" Width="300">
xmlns:vm="clr-namespace:RudeFox.ViewModels" WindowState="Maximized" WindowStartupLocation="CenterScreen"
xmlns:gong="urn:gong-wpf-dragdrop" Icon="/Images/icon_24.png"
Title="{Binding Title}" Height="600" Width="800">
<Window.DataContext>
<vm:MainWindowVM />
</Window.DataContext>
<DockPanel>
<Menu DockPanel.Dock="Top">
<MenuItem Header="_File">
<MenuItem Header="E_xit" Command="{Binding ExitCommand}"/>
</MenuItem>
<MenuItem Header="_Help">
<MenuItem Header="_About" Command="{Binding ShowAboutCommand}"/>
</MenuItem>
</Menu>
<ListBox gong:DragDrop.IsDropTarget="True" gong:DragDrop.DropHandler="{Binding}" ItemsSource="{Binding WorkItems}" HorizontalContentAlignment="Stretch">
<ListBox.ItemTemplate>
<DataTemplate DataType="vm:WorkItemVM">
<Grid Margin="0, 5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="8" />
<RowDefinition />
</Grid.RowDefinitions>

<ListView gong:DragDrop.IsDropTarget="True" gong:DragDrop.DropHandler="{Binding}" ItemsSource="{Binding WorkItems}" HorizontalContentAlignment="Stretch">
<ListBox.ItemTemplate>
<DataTemplate DataType="vm:WorkItemVM">
<Grid Margin="0, 5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="8" />
<RowDefinition />
</Grid.RowDefinitions>
<Image Width="32" VerticalAlignment="Center" Grid.RowSpan="3" Source="{Binding Image}" Margin="10, 0" />

<Image Width="32" VerticalAlignment="Center" Grid.RowSpan="3" Source="{Binding Image}" Margin="10, 0" />
<TextBlock FontSize="14" FontWeight="Light" Text="{Binding Path}" Grid.Column="1" />
<DockPanel LastChildFill="True" Grid.Column="1" Grid.Row="2" >
<TextBlock Foreground="Gray" Text="{Binding Size, StringFormat='{}{0} —'}" Margin="0,0, 10,0"/>
<TextBlock Foreground="Gray" Text="{Binding Progress, StringFormat='{}{0:00.0}%', FallbackValue=0.0}" Margin="0,0, 10,0"/>
<ProgressBar Value="{Binding Progress}" HorizontalAlignment="Stretch" DockPanel.Dock="Right" />
</DockPanel>

<TextBlock FontSize="14" FontWeight="Light" Text="{Binding Path}" Grid.Column="1" />
<DockPanel LastChildFill="True" Grid.Column="1" Grid.Row="2" >
<TextBlock Foreground="Gray" Text="{Binding Size, StringFormat='{}{0} —'}" Margin="0,0, 10,0"/>
<TextBlock Foreground="Gray" Text="{Binding Progress, StringFormat='{}{0:N1}%', FallbackValue=0.0}" Margin="0,0, 10,0"/>
<ProgressBar Value="{Binding Progress}" HorizontalAlignment="Stretch" DockPanel.Dock="Right" />
</DockPanel>

<Button Content="X" Grid.Column="2" Grid.Row="2" Margin="10, 0" Padding="10,0" VerticalAlignment="Center" Command="{Binding CancelCommand}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListView>
<Button Content="X" Grid.Column="2" Grid.Row="2" Margin="10, 0" Padding="10,0" VerticalAlignment="Center" Command="{Binding CancelCommand}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.Style>
<Style TargetType="{x:Type ListBox}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Items.Count, RelativeSource={RelativeSource Self}}" Value="0">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border BorderThickness="1" Background="Transparent" BorderBrush="DarkGray">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="256"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<Image Height="128" Width="128" Grid.Row="1" Source="/Images/icon_128.png"/>
<StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Center" Margin="0,0,0,20">
<TextBlock Text="Nothing to delete" FontSize="28" Margin="0,0,10,0" FontWeight="Light" />
<!--<Image Width="32" Height="32" Source="/Images/sad_32.png"/>-->
</StackPanel>
<TextBlock HorizontalAlignment="Center" Grid.Row="3" FontSize="18">Drop some files and folders here to be deleted.</TextBlock>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ListBox.Style>
</ListBox>
</DockPanel>
</Window>
Binary file added RudeFox.FrontEnd/images/icon.ico
Binary file not shown.
Binary file added RudeFox.FrontEnd/images/icon_128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RudeFox.FrontEnd/images/icon_24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d0696c2

Please sign in to comment.