Added About window

This commit is contained in:
Ben 2015-06-06 17:07:07 +01:00
parent 722c720a06
commit 2628149ab9
11 changed files with 160 additions and 5 deletions

View File

@ -1,5 +1,4 @@
using System;
using System.Linq;
using System.Linq;
using System.Windows;
using Castle.MicroKernel.ModelBuilder.Inspectors;
using Castle.Windsor;

View File

@ -0,0 +1,39 @@
// Taken from http://stackoverflow.com/a/11433814/4153185
using System.Diagnostics;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Navigation;
namespace Filtration.Extensions
{
public static class HyperlinkExtensions
{
public static bool GetIsExternal(DependencyObject obj)
{
return (bool)obj.GetValue(IsExternalProperty);
}
public static void SetIsExternal(DependencyObject obj, bool value)
{
obj.SetValue(IsExternalProperty, value);
}
public static readonly DependencyProperty IsExternalProperty =
DependencyProperty.RegisterAttached("IsExternal", typeof(bool), typeof(HyperlinkExtensions), new UIPropertyMetadata(false, OnIsExternalChanged));
private static void OnIsExternalChanged(object sender, DependencyPropertyChangedEventArgs args)
{
var hyperlink = sender as Hyperlink;
if ((bool)args.NewValue)
hyperlink.RequestNavigate += Hyperlink_RequestNavigate;
else
hyperlink.RequestNavigate -= Hyperlink_RequestNavigate;
}
private static void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
e.Handled = true;
}
}
}

View File

@ -99,6 +99,7 @@
<Compile Include="Enums\SocketColor.cs" />
<Compile Include="Extensions\EnumerationExtension.cs" />
<Compile Include="Extensions\EnumHelper.cs" />
<Compile Include="Extensions\HyperlinkExtensions.cs" />
<Compile Include="Models\BlockItemBaseTypes\ActionBlockItem.cs" />
<Compile Include="Models\BlockItemBaseTypes\ColorBlockItem.cs" />
<Compile Include="Models\BlockItemBaseTypes\DualIntegerBlockItem.cs" />
@ -162,6 +163,9 @@
<Compile Include="Views\LootFilterSectionView.xaml.cs">
<DependentUpon>LootFilterSectionView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\AboutWindow.xaml.cs">
<DependentUpon>AboutWindow.xaml</DependentUpon>
</Compile>
<Compile Include="WindsorInstallers\ModelsInstaller.cs" />
<Compile Include="WindsorInstallers\ServicesInstaller.cs" />
<Compile Include="WindsorInstallers\TranslatorsInstaller.cs" />
@ -220,6 +224,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\AboutWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
@ -257,6 +265,7 @@
<Content Include="Resources\AlertSounds\AlertSound8.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Resource Include="Resources\logo.png" />
<Resource Include="Resources\Icons\add_block_icon.png" />
<Resource Include="Resources\Icons\add_section_icon.png" />
<Resource Include="Resources\Icons\copy_icon.png" />
@ -272,6 +281,7 @@
<Resource Include="Resources\Icons\play_icon.png" />
<Resource Include="Resources\Icons\arrow_top_icon.png" />
<Resource Include="Resources\Icons\arrow_bottom_icon.png" />
<Resource Include="Resources\Icons\about_icon.png" />
<Content Include="Resources\ItemBaseTypes.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

@ -7,6 +7,7 @@ using Castle.Core;
using Filtration.Models;
using Filtration.Services;
using Filtration.Translators;
using Filtration.Views;
using GalaSoft.MvvmLight.CommandWpf;
using Clipboard = System.Windows.Clipboard;
using OpenFileDialog = Microsoft.Win32.OpenFileDialog;
@ -29,7 +30,8 @@ namespace Filtration.ViewModels
private readonly ObservableCollection<ILootFilterScriptViewModel> _scriptViewModels;
public MainWindowViewModel(ILootFilterScriptViewModelFactory lootFilterScriptViewModelFactory,
ILootFilterPersistenceService persistenceService, ILootFilterScriptTranslator lootFilterScriptTranslator)
ILootFilterPersistenceService persistenceService,
ILootFilterScriptTranslator lootFilterScriptTranslator)
{
_lootFilterScriptViewModelFactory = lootFilterScriptViewModelFactory;
_persistenceService = persistenceService;
@ -37,6 +39,7 @@ namespace Filtration.ViewModels
_scriptViewModels = new ObservableCollection<ILootFilterScriptViewModel>();
OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand);
OpenScriptCommand = new RelayCommand(OnOpenScriptCommand);
SaveScriptCommand = new RelayCommand(OnSaveScriptCommand, () => CurrentScriptViewModel != null);
SaveScriptAsCommand = new RelayCommand(OnSaveScriptAsCommand, () => CurrentScriptViewModel != null);
@ -59,6 +62,7 @@ namespace Filtration.ViewModels
public RelayCommand CopyScriptCommand { get; private set; }
public RelayCommand NewScriptCommand { get; private set; }
public RelayCommand<ILootFilterScriptViewModel> CloseScriptCommand { get; private set; }
public RelayCommand OpenAboutWindowCommand { get; private set; }
public ObservableCollection<ILootFilterScriptViewModel> ScriptViewModels
{
@ -88,6 +92,12 @@ namespace Filtration.ViewModels
}
}
private void OnOpenAboutWindowCommand()
{
var aboutWindow = new AboutWindow();
aboutWindow.ShowDialog();
}
private void OnOpenScriptCommand()
{
var openFileDialog = new OpenFileDialog

View File

@ -0,0 +1,71 @@
<controls:MetroWindow x:Class="Filtration.Views.AboutWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:extensions="clr-namespace:Filtration.Extensions"
Title="About Filtration"
Height="360"
Width="560"
Loaded="AboutWindow_OnLoaded"
BorderThickness="1" BorderBrush="Black">
<Grid Margin="15">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Image Source="/Filtration;component/Resources/logo.png" Width="75" Height="75" VerticalAlignment="Top" />
<StackPanel Grid.Row="0" Grid.Column="1">
<TextBlock FontWeight="Black">Filtration</TextBlock>
<TextBlock>Version 0.1</TextBlock>
<TextBlock>Copyright © 2015</TextBlock>
<TextBlock>Created by Ben Wallis</TextBlock>
<TextBlock>
<Hyperlink NavigateUri="http://ben-wallis.github.io/Filtration/" extensions:HyperlinkExtensions.IsExternal="True">http://ben-wallis.github.io/Filtration/</Hyperlink>
<LineBreak />
</TextBlock>
</StackPanel>
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" TextWrapping="Wrap">
As you may be able to tell from the MSPaint logo that I have expertly applied a lens flare to, I am not an artist. If you'd like to create a swanky logo for Filtration please
get in touch via e-mail or IRC.
</TextBlock>
</Grid>
<StackPanel Grid.Row="0" Grid.Column="1">
<TextBlock FontWeight="Bold">Contact</TextBlock>
<TextBlock TextWrapping="Wrap">IRC: irc.freenode.net #filtration</TextBlock>
<TextBlock TextWrapping="Wrap">E-mail: ben-wallis@users.noreply.github.com</TextBlock>
<TextBlock TextWrapping="Wrap">In-Game: AtomYcX</TextBlock>
</StackPanel>
<ScrollViewer Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" Margin="0,20,0,0" >
<TextBlock TextWrapping="Wrap" FontStyle="Italic">
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
<LineBreak />
<LineBreak />
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
<LineBreak />
<LineBreak />
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
</TextBlock>
</ScrollViewer>
</Grid>
</controls:MetroWindow>

View File

@ -0,0 +1,20 @@
using System.Windows;
namespace Filtration.Views
{
public partial class AboutWindow
{
public AboutWindow()
{
InitializeComponent();
}
private void AboutWindow_OnLoaded(object sender, RoutedEventArgs e)
{
var curApp = Application.Current;
var mainWindow = curApp.MainWindow;
Left = mainWindow.Left + (mainWindow.Width - ActualWidth) / 2;
Top = mainWindow.Top + (mainWindow.Height - ActualHeight) / 2;
}
}
}

View File

@ -15,4 +15,5 @@
<Image Source="/Filtration;component/Resources/Icons/arrow_down_large_icon.png" x:Key="MoveDownIcon" x:Shared="false" />
<Image Source="/Filtration;component/Resources/Icons/speaker_icon.png" x:Key="SpeakerIcon" x:Shared="false" />
<Image Source="/Filtration;component/Resources/Icons/play_icon.png" x:Key="PlayIcon" x:Shared="false" />
<Image Source="/Filtration;component/Resources/Icons/about_icon.png" x:Key="AboutIcon" x:Shared="false" />
</ResourceDictionary>

View File

@ -32,7 +32,8 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderThickness="2" BorderBrush="SlateGray" CornerRadius="4" Margin="5,5,5,0">
<!--<Border Grid.Row="0" BorderThickness="2" BorderBrush="SlateGray" CornerRadius="4" Margin="5,5,5,0">-->
<Border Grid.Row="0" BorderThickness="1" BorderBrush="DarkGray" Margin="5,5,5,0">
<StackPanel Margin="2,2,2,2">
<Expander Style="{StaticResource ExpanderRightAlignStyle}">
<Expander.Header>
@ -44,7 +45,8 @@
</Expander>
</StackPanel>
</Border>
<Border Grid.Row="1" BorderThickness="2" BorderBrush="SlateGray" CornerRadius="4" Margin="5,5,5,5">
<!--<Border Grid.Row="1" BorderThickness="2" BorderBrush="SlateGray" CornerRadius="4" Margin="5,5,5,5">-->
<Border Grid.Row="1" BorderThickness="1" BorderBrush="DarkGray" Margin="5,5,5,5" Padding="2">
<DockPanel LastChildFill="True">
<ToolBarTray DockPanel.Dock="Top">
<ToolBar>

View File

@ -27,6 +27,9 @@
<Separator />
<MenuItem Header="Copy _Script" Command="{Binding CopyScriptCommand}" Icon="{StaticResource CopyIcon}" />
</MenuItem>
<MenuItem Header="_Help">
<MenuItem Header="_About" Command="{Binding OpenAboutWindowCommand}" Icon="{StaticResource AboutIcon}" />
</MenuItem>
</Menu>
<ToolBarTray DockPanel.Dock="Top">
<ToolBar>