diff --git a/Filtration/App.xaml.cs b/Filtration/App.xaml.cs index ead2fca..2c37286 100644 --- a/Filtration/App.xaml.cs +++ b/Filtration/App.xaml.cs @@ -1,5 +1,4 @@ -using System; -using System.Linq; +using System.Linq; using System.Windows; using Castle.MicroKernel.ModelBuilder.Inspectors; using Castle.Windsor; diff --git a/Filtration/Extensions/HyperlinkExtensions.cs b/Filtration/Extensions/HyperlinkExtensions.cs new file mode 100644 index 0000000..b7b9a38 --- /dev/null +++ b/Filtration/Extensions/HyperlinkExtensions.cs @@ -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; + } + } +} diff --git a/Filtration/Filtration.csproj b/Filtration/Filtration.csproj index e532b05..c85fc20 100644 --- a/Filtration/Filtration.csproj +++ b/Filtration/Filtration.csproj @@ -99,6 +99,7 @@ + @@ -162,6 +163,9 @@ LootFilterSectionView.xaml + + AboutWindow.xaml + @@ -220,6 +224,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + @@ -257,6 +265,7 @@ PreserveNewest + @@ -272,6 +281,7 @@ + Always diff --git a/Filtration/Resources/Icons/about_icon.png b/Filtration/Resources/Icons/about_icon.png new file mode 100644 index 0000000..3ef509a Binary files /dev/null and b/Filtration/Resources/Icons/about_icon.png differ diff --git a/Filtration/Resources/logo.png b/Filtration/Resources/logo.png new file mode 100644 index 0000000..9454b87 Binary files /dev/null and b/Filtration/Resources/logo.png differ diff --git a/Filtration/ViewModels/MainWindowViewModel.cs b/Filtration/ViewModels/MainWindowViewModel.cs index c692cc6..ca97111 100644 --- a/Filtration/ViewModels/MainWindowViewModel.cs +++ b/Filtration/ViewModels/MainWindowViewModel.cs @@ -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 _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(); + 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 CloseScriptCommand { get; private set; } + public RelayCommand OpenAboutWindowCommand { get; private set; } public ObservableCollection ScriptViewModels { @@ -88,6 +92,12 @@ namespace Filtration.ViewModels } } + private void OnOpenAboutWindowCommand() + { + var aboutWindow = new AboutWindow(); + aboutWindow.ShowDialog(); + } + private void OnOpenScriptCommand() { var openFileDialog = new OpenFileDialog diff --git a/Filtration/Views/AboutWindow.xaml b/Filtration/Views/AboutWindow.xaml new file mode 100644 index 0000000..0386340 --- /dev/null +++ b/Filtration/Views/AboutWindow.xaml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + Filtration + Version 0.1 + Copyright © 2015 + Created by Ben Wallis + + http://ben-wallis.github.io/Filtration/ + + + + + 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. + + + + Contact + IRC: irc.freenode.net #filtration + E-mail: ben-wallis@users.noreply.github.com + In-Game: AtomYcX + + + + 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. + + + 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. + + + 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. + + + + diff --git a/Filtration/Views/AboutWindow.xaml.cs b/Filtration/Views/AboutWindow.xaml.cs new file mode 100644 index 0000000..800b608 --- /dev/null +++ b/Filtration/Views/AboutWindow.xaml.cs @@ -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; + } + } +} diff --git a/Filtration/Views/IconsDictionary.xaml b/Filtration/Views/IconsDictionary.xaml index fc094af..35dcba0 100644 --- a/Filtration/Views/IconsDictionary.xaml +++ b/Filtration/Views/IconsDictionary.xaml @@ -15,4 +15,5 @@ + \ No newline at end of file diff --git a/Filtration/Views/LootFilterScriptView.xaml b/Filtration/Views/LootFilterScriptView.xaml index 544e26e..1d70de3 100644 --- a/Filtration/Views/LootFilterScriptView.xaml +++ b/Filtration/Views/LootFilterScriptView.xaml @@ -32,7 +32,8 @@ - + + @@ -44,7 +45,8 @@ - + + diff --git a/Filtration/Views/MainWindow.xaml b/Filtration/Views/MainWindow.xaml index 3726bce..0217603 100644 --- a/Filtration/Views/MainWindow.xaml +++ b/Filtration/Views/MainWindow.xaml @@ -27,6 +27,9 @@ + + +