Added Default Path of Exile directory to saved settings

This commit is contained in:
Ben 2015-06-24 21:24:38 +01:00
parent c6f5dcda39
commit 1ba3b3f850
18 changed files with 218 additions and 28 deletions

View File

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// 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("Filtration.ObjectModel.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Filtration.ObjectModel.Tests")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7ed27cde-6bc5-4d11-b45d-8823de2077ce")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,6 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<configuration> <configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Filtration.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup> </startup>
<userSettings>
<Filtration.Properties.Settings>
<setting name="DefaultFilterDirectory" serializeAs="String">
<value />
</setting>
</Filtration.Properties.Settings>
</userSettings>
</configuration> </configuration>

View File

@ -3,6 +3,7 @@ using System.Windows;
using Castle.MicroKernel.ModelBuilder.Inspectors; using Castle.MicroKernel.ModelBuilder.Inspectors;
using Castle.Windsor; using Castle.Windsor;
using Castle.Windsor.Installer; using Castle.Windsor.Installer;
using Filtration.Properties;
using Filtration.Views; using Filtration.Views;
namespace Filtration namespace Filtration
@ -31,6 +32,7 @@ namespace Filtration
protected override void OnExit(ExitEventArgs e) protected override void OnExit(ExitEventArgs e)
{ {
_container.Dispose(); _container.Dispose();
Settings.Default.Save();
base.OnExit(e); base.OnExit(e);
} }
} }

View File

@ -121,6 +121,7 @@
<Compile Include="Services\FileSystemService.cs" /> <Compile Include="Services\FileSystemService.cs" />
<Compile Include="Services\ItemFilterPersistenceService.cs" /> <Compile Include="Services\ItemFilterPersistenceService.cs" />
<Compile Include="Services\StaticDataService.cs" /> <Compile Include="Services\StaticDataService.cs" />
<Compile Include="Settings.cs" />
<Compile Include="Translators\BlockGroupHierarchyBuilder.cs" /> <Compile Include="Translators\BlockGroupHierarchyBuilder.cs" />
<Compile Include="Translators\ItemFilterBlockTranslator.cs" /> <Compile Include="Translators\ItemFilterBlockTranslator.cs" />
<Compile Include="Translators\ItemFilterScriptTranslator.cs" /> <Compile Include="Translators\ItemFilterScriptTranslator.cs" />
@ -346,6 +347,8 @@
<Resource Include="Resources\Icons\filter_icon.png" /> <Resource Include="Resources\Icons\filter_icon.png" />
<Resource Include="Resources\Icons\show_advanced_icon.png" /> <Resource Include="Resources\Icons\show_advanced_icon.png" />
<Resource Include="Resources\Icons\block_output_preview_icon.png" /> <Resource Include="Resources\Icons\block_output_preview_icon.png" />
<Resource Include="Resources\Icons\collapse_icon.png" />
<Resource Include="Resources\Icons\expand_icon.png" />
<Content Include="Resources\ItemBaseTypes.txt"> <Content Include="Resources\ItemBaseTypes.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>

View File

@ -1,30 +1,38 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.34209 // Runtime Version:4.0.30319.0
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace Filtration.Properties namespace Filtration.Properties {
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default public static Settings Default {
{ get {
get
{
return defaultInstance; return defaultInstance;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string DefaultFilterDirectory {
get {
return ((string)(this["DefaultFilterDirectory"]));
}
set {
this["DefaultFilterDirectory"] = value;
}
}
} }
} }

View File

@ -1,7 +1,9 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> <SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Filtration.Properties" GeneratedClassName="Settings">
<Profiles> <Profiles />
<Profile Name="(Default)" /> <Settings>
</Profiles> <Setting Name="DefaultFilterDirectory" Type="System.String" Scope="User">
<Settings /> <Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile> </SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

View File

@ -1,5 +1,6 @@
using System.IO; using System.IO;
using Filtration.ObjectModel; using Filtration.ObjectModel;
using Filtration.Properties;
using Filtration.Translators; using Filtration.Translators;
namespace Filtration.Services namespace Filtration.Services
@ -23,7 +24,15 @@ namespace Filtration.Services
_fileSystemService = fileSystemService; _fileSystemService = fileSystemService;
_itemFilterScriptTranslator = itemFilterScriptTranslator; _itemFilterScriptTranslator = itemFilterScriptTranslator;
ItemFilterScriptDirectory = DefaultPathOfExileDirectory(); if (string.IsNullOrEmpty(Settings.Default.DefaultFilterDirectory))
{
ItemFilterScriptDirectory = DefaultPathOfExileDirectory();
Settings.Default.DefaultFilterDirectory = ItemFilterScriptDirectory;
}
else
{
ItemFilterScriptDirectory = Settings.Default.DefaultFilterDirectory;
}
} }
public string ItemFilterScriptDirectory { get; private set; } public string ItemFilterScriptDirectory { get; private set; }
@ -45,6 +54,7 @@ namespace Filtration.Services
} }
ItemFilterScriptDirectory = path; ItemFilterScriptDirectory = path;
Settings.Default.DefaultFilterDirectory = path;
} }
public ItemFilterScript LoadItemFilterScript(string filePath) public ItemFilterScript LoadItemFilterScript(string filePath)

28
Filtration/Settings.cs Normal file
View File

@ -0,0 +1,28 @@
namespace Filtration.Properties {
// This class allows you to handle specific events on the settings class:
// The SettingChanging event is raised before a setting's value is changed.
// The PropertyChanged event is raised after a setting's value is changed.
// The SettingsLoaded event is raised after the setting values are loaded.
// The SettingsSaving event is raised before the setting values are saved.
internal sealed partial class Settings {
public Settings() {
// // To add event handlers for saving and changing settings, uncomment the lines below:
//
// this.SettingChanging += this.SettingChangingEventHandler;
//
// this.SettingsSaving += this.SettingsSavingEventHandler;
//
}
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// Add code to handle the SettingChangingEvent event here.
}
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// Add code to handle the SettingsSaving event here.
}
}
}

View File

@ -40,6 +40,7 @@ namespace Filtration.ViewModels
_sectionBrowserViewModel.Initialise(this); _sectionBrowserViewModel.Initialise(this);
_blockGroupBrowserViewModel.Initialise(this); _blockGroupBrowserViewModel.Initialise(this);
_blockOutputPreviewViewModel.Initialise(this);
_openDocuments = new ObservableCollection<IDocument> {startPageViewModel}; _openDocuments = new ObservableCollection<IDocument> {startPageViewModel};
ActiveDocument = startPageViewModel; ActiveDocument = startPageViewModel;
@ -135,6 +136,7 @@ namespace Filtration.ViewModels
{ {
_sectionBrowserViewModel.ClearDown(); _sectionBrowserViewModel.ClearDown();
_blockGroupBrowserViewModel.ClearDown(); _blockGroupBrowserViewModel.ClearDown();
_blockOutputPreviewViewModel.ClearDown();
} }
OpenDocuments.Remove(document); OpenDocuments.Remove(document);

View File

@ -9,6 +9,7 @@ namespace Filtration.ViewModels
private bool? _isChecked; private bool? _isChecked;
private bool _reentrancyCheck; private bool _reentrancyCheck;
private bool _postMapComplete; private bool _postMapComplete;
private bool _isExpanded;
public ItemFilterBlockGroupViewModel() public ItemFilterBlockGroupViewModel()
{ {
@ -54,6 +55,16 @@ namespace Filtration.ViewModels
} }
} }
public bool IsExpanded
{
get { return _isExpanded; }
set
{
_isExpanded = value;
RaisePropertyChanged();
}
}
private void UpdateCheckState() private void UpdateCheckState()
{ {
// update all children: // update all children:

View File

@ -165,8 +165,12 @@ namespace Filtration.ViewModels
get { return _selectedBlockViewModel; } get { return _selectedBlockViewModel; }
set set
{ {
_selectedBlockViewModel = value; if (value != _selectedBlockViewModel)
RaisePropertyChanged(); {
_selectedBlockViewModel = value;
Messenger.Default.Send(new NotificationMessage("SelectedBlockChanged"));
RaisePropertyChanged();
}
} }
} }

View File

@ -1,17 +1,24 @@
using System; using System;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using Filtration.Translators;
using GalaSoft.MvvmLight.Messaging;
namespace Filtration.ViewModels.ToolPanes namespace Filtration.ViewModels.ToolPanes
{ {
internal interface IBlockOutputPreviewViewModel : IToolViewModel internal interface IBlockOutputPreviewViewModel : IToolViewModel
{ {
bool IsVisible { get; set; } bool IsVisible { get; set; }
void ClearDown();
} }
internal class BlockOutputPreviewViewModel : ToolViewModel, IBlockOutputPreviewViewModel internal class BlockOutputPreviewViewModel : ToolViewModel, IBlockOutputPreviewViewModel
{ {
public BlockOutputPreviewViewModel() : base("Block Output Preview") private readonly IItemFilterBlockTranslator _itemFilterBlockTranslator;
private string _previewText;
public BlockOutputPreviewViewModel(IItemFilterBlockTranslator itemFilterBlockTranslator) : base("Block Output Preview")
{ {
_itemFilterBlockTranslator = itemFilterBlockTranslator;
ContentId = ToolContentId; ContentId = ToolContentId;
var icon = new BitmapImage(); var icon = new BitmapImage();
icon.BeginInit(); icon.BeginInit();
@ -19,10 +26,56 @@ namespace Filtration.ViewModels.ToolPanes
icon.EndInit(); icon.EndInit();
IconSource = icon; IconSource = icon;
IsVisible = false; IsVisible = false;
Messenger.Default.Register<NotificationMessage>(this, message =>
{
switch (message.Notification)
{
case "SelectedBlockChanged":
{
OnSelectedBlockChanged(null, null);
break;
}
case "ActiveDocumentChanged":
{
OnSelectedBlockChanged(null, null);
break;
}
}
});
} }
public const string ToolContentId = "BlockOutputPreviewTool"; public const string ToolContentId = "BlockOutputPreviewTool";
public string PreviewText
{
get { return _previewText; }
private set
{
_previewText = value;
RaisePropertyChanged();
}
}
public void ClearDown()
{
PreviewText = string.Empty;
}
private void OnSelectedBlockChanged(object sender, EventArgs e)
{
if (AvalonDockWorkspaceViewModel.ActiveScriptViewModel == null ||
AvalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel == null)
{
PreviewText = string.Empty;
return;
}
PreviewText =
_itemFilterBlockTranslator.TranslateItemFilterBlockToString(
AvalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel.Block);
}
} }
} }

View File

@ -22,4 +22,6 @@
<Image Source="/Filtration;component/Resources/Icons/show_advanced_icon.png" x:Key="ShowAdvancedIcon" x:Shared="False" /> <Image Source="/Filtration;component/Resources/Icons/show_advanced_icon.png" x:Key="ShowAdvancedIcon" x:Shared="False" />
<Image Source="/Filtration;component/Resources/Icons/block_group_browser_icon.png" x:Key="BlockGroupBrowserIcon" x:Shared="False" /> <Image Source="/Filtration;component/Resources/Icons/block_group_browser_icon.png" x:Key="BlockGroupBrowserIcon" x:Shared="False" />
<Image Source="/Filtration;component/Resources/Icons/block_output_preview_icon.png" x:Key="BlockOutputPreviewIcon" x:Shared="False" /> <Image Source="/Filtration;component/Resources/Icons/block_output_preview_icon.png" x:Key="BlockOutputPreviewIcon" x:Shared="False" />
<Image Source="/Filtration;component/Resources/Icons/expand_icon.png" x:Key="ExpandIcon" x:Shared="False" />
<Image Source="/Filtration;component/Resources/Icons/collapse_icon.png" x:Key="CollapseIcon" x:Shared="False" />
</ResourceDictionary> </ResourceDictionary>

View File

@ -21,17 +21,27 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<ToolBar Grid.Row="0"> <ToolBar Grid.Row="0">
<Button Height="20" Command="{Binding FilterToSelectedBlockGroupCommand}" Content="{StaticResource FilterIcon}" ToolTip="Filter to Selected Block Group" /> <Button Height="20" Command="{Binding FilterToSelectedBlockGroupCommand}" Content="{StaticResource FilterIcon}" ToolTip="Filter to Selected Block Group" />
<Button Height="20" Content="{StaticResource ExpandIcon}" ToolTip="Expand All (Not Implemented)" Name="ExpandAllButton" />
<Button Height="20" Content="{StaticResource CollapseIcon}" ToolTip="Collapse All (Not Implemented)" Name="CollapseAllButton" />
</ToolBar> </ToolBar>
<TreeView Grid.Row="1" ItemsSource="{Binding BlockGroupViewModels}" Name="TreeView"> <TreeView Grid.Row="1" ItemsSource="{Binding BlockGroupViewModels}" Name="TreeView">
<TreeView.Style>
<Style TargetType="{x:Type TreeView}"></Style>
</TreeView.Style>
<i:Interaction.Behaviors> <i:Interaction.Behaviors>
<behaviors:BindableSelectedItemBehavior SelectedItem="{Binding SelectedBlockGroupViewModel, Mode=OneWayToSource}" /> <behaviors:BindableSelectedItemBehavior SelectedItem="{Binding SelectedBlockGroupViewModel, Mode=OneWayToSource}" />
</i:Interaction.Behaviors> </i:Interaction.Behaviors>
<TreeView.Resources> <TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type viewModels:ItemFilterBlockGroupViewModel}" ItemsSource="{Binding ChildGroups}"> <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> <WrapPanel>
<CheckBox IsThreeState="True" IsChecked="{Binding IsChecked}" Click="BlockGroupCheckBox_Clicked" /> <CheckBox IsThreeState="True" IsChecked="{Binding IsChecked}" Click="BlockGroupCheckBox_Clicked" />
<TextBlock Text="{Binding GroupName}" Foreground="{Binding Advanced, Converter={StaticResource BlockGroupAdvancedColorConverter}}" /> <TextBlock Text="{Binding GroupName}" Foreground="{Binding Advanced, Converter={StaticResource BlockGroupAdvancedColorConverter}}" />
</WrapPanel> </WrapPanel>
</HierarchicalDataTemplate> </HierarchicalDataTemplate>
</TreeView.Resources> </TreeView.Resources>

View File

@ -3,9 +3,11 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:toolPanes="clr-namespace:Filtration.ViewModels.ToolPanes"
d:DataContext="{d:DesignInstance Type=toolPanes:BlockOutputPreviewViewModel}"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"> d:DesignHeight="300" d:DesignWidth="300">
<Grid> <Grid>
<TextBlock>This is the Block Text Preview Pane</TextBlock> <TextBlock Text="{Binding PreviewText}" ToolTip="{Binding PreviewText}" Margin="10" />
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
</configuration>