Added settings window
This commit is contained in:
parent
1ba3b3f850
commit
4faa12474a
|
@ -55,6 +55,7 @@
|
|||
<Compile Include="Translators\TestItemFilterScriptTranslator.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Xceed.Wpf.AvalonDock" publicKeyToken="3e4669d2f30244f4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -13,6 +13,17 @@
|
|||
<setting name="DefaultFilterDirectory" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="ExtraLineBetweenBlocks" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</Filtration.Properties.Settings>
|
||||
</userSettings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Xceed.Wpf.AvalonDock" publicKeyToken="3e4669d2f30244f4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -91,6 +91,21 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>.\Xceed.Wpf.AvalonDock.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>.\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>.\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>.\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2013">
|
||||
<HintPath>.\Xceed.Wpf.AvalonDock.Themes.VS2013.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.Toolkit, Version=2.4.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.4\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||
|
@ -137,6 +152,7 @@
|
|||
<Compile Include="Utilities\BlockGroupMapper.cs" />
|
||||
<Compile Include="Utilities\LineReader.cs" />
|
||||
<Compile Include="ViewModels\AvalonDockWorkspaceViewModel.cs" />
|
||||
<Compile Include="ViewModels\SettingsWindowViewModel.cs" />
|
||||
<Compile Include="ViewModels\ToolPanes\BlockGroupBrowserViewModel.cs" />
|
||||
<Compile Include="ViewModels\FiltrationViewModelBase.cs" />
|
||||
<Compile Include="ViewModels\IDocument.cs" />
|
||||
|
@ -158,6 +174,9 @@
|
|||
<Compile Include="Views\Behaviors\BindableSelectedItemBehavior.cs" />
|
||||
<Compile Include="Views\BindingProxy.cs" />
|
||||
<Compile Include="Views\PathOfExileColors.cs" />
|
||||
<Compile Include="Views\SettingsWindow.xaml.cs">
|
||||
<DependentUpon>SettingsWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ToolPanes\BlockGroupBrowserView.xaml.cs">
|
||||
<DependentUpon>BlockGroupBrowserView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
@ -209,6 +228,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\SettingsWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ToolPanes\BlockGroupBrowserView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
|
|
@ -34,5 +34,17 @@ namespace Filtration.Properties {
|
|||
this["DefaultFilterDirectory"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool ExtraLineBetweenBlocks {
|
||||
get {
|
||||
return ((bool)(this["ExtraLineBetweenBlocks"]));
|
||||
}
|
||||
set {
|
||||
this["ExtraLineBetweenBlocks"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,5 +5,8 @@
|
|||
<Setting Name="DefaultFilterDirectory" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="ExtraLineBetweenBlocks" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
|
@ -24,20 +24,24 @@ namespace Filtration.ViewModels
|
|||
private readonly IItemFilterScriptTranslator _itemFilterScriptTranslator;
|
||||
private readonly IReplaceColorsViewModel _replaceColorsViewModel;
|
||||
private readonly IAvalonDockWorkspaceViewModel _avalonDockWorkspaceViewModel;
|
||||
private readonly ISettingsWindowViewModel _settingsWindowViewModel;
|
||||
|
||||
private IDocument _activeDocument;
|
||||
|
||||
public MainWindowViewModel(IItemFilterScriptRepository itemFilterScriptRepository,
|
||||
IItemFilterScriptTranslator itemFilterScriptTranslator,
|
||||
IReplaceColorsViewModel replaceColorsViewModel,
|
||||
IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel)
|
||||
IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel,
|
||||
ISettingsWindowViewModel settingsWindowViewModel)
|
||||
{
|
||||
_itemFilterScriptRepository = itemFilterScriptRepository;
|
||||
_itemFilterScriptTranslator = itemFilterScriptTranslator;
|
||||
_replaceColorsViewModel = replaceColorsViewModel;
|
||||
_avalonDockWorkspaceViewModel = avalonDockWorkspaceViewModel;
|
||||
_settingsWindowViewModel = settingsWindowViewModel;
|
||||
|
||||
OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand);
|
||||
OpenSettingsWindowCommand = new RelayCommand(OnOpenSettingsWindowCommand);
|
||||
OpenScriptCommand = new RelayCommand(OnOpenScriptCommand);
|
||||
SaveScriptCommand = new RelayCommand(OnSaveScriptCommand, ActiveDocumentIsScript);
|
||||
SaveScriptAsCommand = new RelayCommand(OnSaveScriptAsCommand, ActiveDocumentIsScript);
|
||||
|
@ -95,6 +99,7 @@ namespace Filtration.ViewModels
|
|||
public RelayCommand NewScriptCommand { get; private set; }
|
||||
public RelayCommand CloseScriptCommand { get; private set; }
|
||||
public RelayCommand OpenAboutWindowCommand { get; private set; }
|
||||
public RelayCommand OpenSettingsWindowCommand { get; private set; }
|
||||
public RelayCommand ReplaceColorsCommand { get; private set; }
|
||||
|
||||
public IAvalonDockWorkspaceViewModel AvalonDockWorkspaceViewModel
|
||||
|
@ -123,6 +128,13 @@ namespace Filtration.ViewModels
|
|||
aboutWindow.ShowDialog();
|
||||
}
|
||||
|
||||
private void OnOpenSettingsWindowCommand()
|
||||
{
|
||||
var settingsWindow = new SettingsWindow {DataContext = _settingsWindowViewModel};
|
||||
_settingsWindowViewModel.OnRequestClose += (s, e) => settingsWindow.Close();
|
||||
settingsWindow.ShowDialog();
|
||||
}
|
||||
|
||||
private void OnOpenScriptCommand()
|
||||
{
|
||||
var openFileDialog = new OpenFileDialog
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using Filtration.Properties;
|
||||
using Filtration.Services;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal interface ISettingsWindowViewModel
|
||||
{
|
||||
event EventHandler OnRequestClose;
|
||||
}
|
||||
|
||||
internal class SettingsWindowViewModel : FiltrationViewModelBase, ISettingsWindowViewModel
|
||||
{
|
||||
private readonly IItemFilterPersistenceService _itemFilterPersistenceService;
|
||||
|
||||
public SettingsWindowViewModel(IItemFilterPersistenceService itemFilterPersistenceService)
|
||||
{
|
||||
_itemFilterPersistenceService = itemFilterPersistenceService;
|
||||
CancelCommand = new RelayCommand(OnCancelCommand);
|
||||
SaveCommand = new RelayCommand(OnSaveCommand);
|
||||
|
||||
DefaultFilterDirectory = Settings.Default.DefaultFilterDirectory;
|
||||
ExtraLineBetweenBlocks = Settings.Default.ExtraLineBetweenBlocks;
|
||||
}
|
||||
|
||||
public event EventHandler OnRequestClose;
|
||||
|
||||
public RelayCommand CancelCommand { get; private set; }
|
||||
public RelayCommand SaveCommand { get; private set; }
|
||||
|
||||
public string DefaultFilterDirectory { get; set; }
|
||||
public bool ExtraLineBetweenBlocks { get; set; }
|
||||
|
||||
private void OnCancelCommand()
|
||||
{
|
||||
if (OnRequestClose != null)
|
||||
{
|
||||
OnRequestClose(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSaveCommand()
|
||||
{
|
||||
try
|
||||
{
|
||||
_itemFilterPersistenceService.SetItemFilterScriptDirectory(DefaultFilterDirectory);
|
||||
|
||||
Settings.Default.ExtraLineBetweenBlocks = ExtraLineBetweenBlocks;
|
||||
if (OnRequestClose != null)
|
||||
{
|
||||
OnRequestClose(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
catch (DirectoryNotFoundException e)
|
||||
{
|
||||
MessageBox.Show("The entered Default Filter Directory is invalid or does not exist.", "Error",
|
||||
MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,6 +23,9 @@
|
|||
AllowMixedOrientation="True"
|
||||
DocumentsSource="{Binding OpenDocuments}"
|
||||
ActiveContent="{Binding ActiveDocument, Mode=TwoWay, Converter={StaticResource ActiveDocumentConverter}}" >
|
||||
<xcad:DockingManager.Theme>
|
||||
<xcad:Vs2013LightTheme />
|
||||
</xcad:DockingManager.Theme>
|
||||
<xcad:DockingManager.LayoutItemTemplateSelector>
|
||||
<viewsAvalonDock:PanesTemplateSelector>
|
||||
<viewsAvalonDock:PanesTemplateSelector.ItemFilterScriptTemplate>
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
</MenuItem>
|
||||
<MenuItem Header="_Tools">
|
||||
<MenuItem Header="_Replace Colors" Command="{Binding ReplaceColorsCommand}" Icon="{StaticResource ReplaceColorsIcon}" />
|
||||
<MenuItem Header="_Settings" Command="{Binding OpenSettingsWindowCommand}" />
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Help">
|
||||
<MenuItem Header="_About" Command="{Binding OpenAboutWindowCommand}" Icon="{StaticResource AboutIcon}" />
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<controls:MetroWindow x:Class="Filtration.Views.SettingsWindow"
|
||||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:SettingsWindowViewModel}"
|
||||
Title="Options" Height="150" Width="500" IsMaxRestoreButtonEnabled="False">
|
||||
<DockPanel Margin="10">
|
||||
<Grid DockPanel.Dock="Bottom">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="5" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Grid.Column="0">Default Filter Directory:</TextBlock>
|
||||
<TextBox Grid.Row="0" Grid.Column="2" Text="{Binding DefaultFilterDirectory}" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="0">Add blank line between blocks when saving</TextBlock>
|
||||
<CheckBox Grid.Row="2" Grid.Column="2" IsChecked="{Binding ExtraLineBetweenBlocks}" />
|
||||
</Grid>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Right">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="{x:Type Button}">
|
||||
<Setter Property="Width" Value="80" />
|
||||
<Setter Property="Margin" Value="3" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<Button Command="{Binding SaveCommand}">OK</Button>
|
||||
<Button Command="{Binding CancelCommand}">Cancel</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
</DockPanel>
|
||||
</controls:MetroWindow>
|
|
@ -0,0 +1,10 @@
|
|||
namespace Filtration.Views
|
||||
{
|
||||
public partial class SettingsWindow
|
||||
{
|
||||
public SettingsWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,19 +26,11 @@
|
|||
</ToolBar>
|
||||
|
||||
<TreeView Grid.Row="1" ItemsSource="{Binding BlockGroupViewModels}" Name="TreeView">
|
||||
<TreeView.Style>
|
||||
<Style TargetType="{x:Type TreeView}"></Style>
|
||||
</TreeView.Style>
|
||||
<i:Interaction.Behaviors>
|
||||
<behaviors:BindableSelectedItemBehavior SelectedItem="{Binding SelectedBlockGroupViewModel, Mode=OneWayToSource}" />
|
||||
</i:Interaction.Behaviors>
|
||||
<TreeView.Resources>
|
||||
<HierarchicalDataTemplate DataType="{x:Type viewModels:ItemFilterBlockGroupViewModel}" ItemsSource="{Binding ChildGroups}">
|
||||
<HierarchicalDataTemplate.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type TreeViewItem}">
|
||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded}" />
|
||||
</Style>
|
||||
</HierarchicalDataTemplate.ItemContainerStyle>
|
||||
<WrapPanel>
|
||||
<CheckBox IsThreeState="True" IsChecked="{Binding IsChecked}" Click="BlockGroupCheckBox_Clicked" />
|
||||
<TextBlock Text="{Binding GroupName}" Foreground="{Binding Advanced, Converter={StaticResource BlockGroupAdvancedColorConverter}}" />
|
||||
|
|
|
@ -56,6 +56,11 @@ namespace Filtration.WindsorInstallers
|
|||
.ImplementedBy<BlockOutputPreviewViewModel>()
|
||||
.LifeStyle.Singleton);
|
||||
|
||||
container.Register(
|
||||
Component.For<ISettingsWindowViewModel>()
|
||||
.ImplementedBy<SettingsWindowViewModel>()
|
||||
.LifeStyle.Transient);
|
||||
|
||||
container.AddFacility<TypedFactoryFacility>();
|
||||
container.Register(
|
||||
Component.For<IItemFilterBlockViewModelFactory>().AsFactory());
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="AutoMapper" version="3.3.1" targetFramework="net451" />
|
||||
<package id="AvalonDock" version="2.0.2000" targetFramework="net451" />
|
||||
<package id="Castle.Core" version="3.3.0" targetFramework="net451" />
|
||||
<package id="Castle.Windsor" version="3.3.0" targetFramework="net451" />
|
||||
<package id="CommonServiceLocator" version="1.3" targetFramework="net451" />
|
||||
|
|
Loading…
Reference in New Issue