diff --git a/Filtration/App.xaml b/Filtration/App.xaml
index 2165bdd..c6c1856 100644
--- a/Filtration/App.xaml
+++ b/Filtration/App.xaml
@@ -7,16 +7,13 @@
+
+
+
+
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Filtration/App.xaml.cs b/Filtration/App.xaml.cs
index 978d55d..7f334f0 100644
--- a/Filtration/App.xaml.cs
+++ b/Filtration/App.xaml.cs
@@ -1,11 +1,14 @@
-using System.Linq;
+using System.IO.Compression;
+using System.Linq;
using System.Windows;
using AutoMapper;
using Castle.Facilities.TypedFactory;
using Castle.MicroKernel.ModelBuilder.Inspectors;
using Castle.Windsor;
using Castle.Windsor.Installer;
+using Filtration.ObjectModel;
using Filtration.Properties;
+using Filtration.ViewModels;
using Filtration.Views;
namespace Filtration
@@ -27,8 +30,25 @@ namespace Filtration
_container.AddFacility();
_container.Install(FromAssembly.InThisApplication());
-
+
Mapper.Configuration.ConstructServicesUsing(_container.Resolve);
+
+ Mapper.CreateMap()
+ .ForMember(destination => destination.ChildGroups, options => options.ResolveUsing(
+ delegate(ResolutionResult resolutionResult)
+ {
+ var context = resolutionResult.Context;
+ var showAdvanced = (bool) context.Options.Items["showAdvanced"];
+ var group = (ItemFilterBlockGroup) context.SourceValue;
+ if (showAdvanced)
+ return group.ChildGroups;
+ else
+ return group.ChildGroups.Where(c => c.Advanced == false);
+ }))
+ .ForMember(dest => dest.SourceBlockGroup,
+ opts => opts.MapFrom(from => from))
+ .ForMember(dest => dest.IsExpanded,
+ opts => opts.UseValue(false));
Mapper.AssertConfigurationIsValid();
@@ -36,6 +56,11 @@ namespace Filtration
mainWindow.Show();
}
+ public void TestTest()
+ {
+
+ }
+
protected override void OnExit(ExitEventArgs e)
{
_container.Dispose();
diff --git a/Filtration/Converters/TreeViewMarginConverter.cs b/Filtration/Converters/TreeViewMarginConverter.cs
new file mode 100644
index 0000000..82165ae
--- /dev/null
+++ b/Filtration/Converters/TreeViewMarginConverter.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Media;
+
+namespace Filtration.Converters
+{
+ public class TreeViewMarginConverter : IValueConverter
+ {
+ public double Length { get; set; }
+
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ var item = value as TreeViewItem;
+ if (item == null)
+ return new Thickness(0);
+
+ return new Thickness(Length * item.GetDepth(), 0, 0, 0);
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return DependencyProperty.UnsetValue;
+ }
+ }
+
+ public static class TreeViewItemExtensions
+ {
+ public static int GetDepth(this TreeViewItem item)
+ {
+ TreeViewItem parent;
+ while ((parent = GetParent(item)) != null)
+ {
+ return GetDepth(parent) + 1;
+ }
+ return 0;
+ }
+
+ private static TreeViewItem GetParent(TreeViewItem item)
+ {
+ var parent = item != null ? VisualTreeHelper.GetParent(item) : null;
+ while (parent != null && !(parent is TreeViewItem || parent is TreeView))
+ {
+ parent = VisualTreeHelper.GetParent(parent);
+ }
+ return parent as TreeViewItem;
+ }
+ }
+}
diff --git a/Filtration/Filtration.csproj b/Filtration/Filtration.csproj
index d7ca5d3..31afc57 100644
--- a/Filtration/Filtration.csproj
+++ b/Filtration/Filtration.csproj
@@ -132,6 +132,7 @@
+
@@ -177,6 +178,10 @@
SettingsPageView.xaml
+
+ MSBuild:Compile
+ Designer
+
BlockGroupBrowserView.xaml
@@ -232,6 +237,18 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/Filtration/Properties/AssemblyInfo.cs b/Filtration/Properties/AssemblyInfo.cs
index 3bba460..dc4bb9b 100644
--- a/Filtration/Properties/AssemblyInfo.cs
+++ b/Filtration/Properties/AssemblyInfo.cs
@@ -50,7 +50,7 @@ using System.Windows;
// 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("0.3.*")]
+[assembly: AssemblyVersion("0.4.*")]
[assembly: InternalsVisibleTo("Filtration.Tests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
\ No newline at end of file
diff --git a/Filtration/Utilities/BlockGroupMapper.cs b/Filtration/Utilities/BlockGroupMapper.cs
index ad33612..3091b8b 100644
--- a/Filtration/Utilities/BlockGroupMapper.cs
+++ b/Filtration/Utilities/BlockGroupMapper.cs
@@ -1,5 +1,6 @@
using System.Collections.ObjectModel;
using System.Linq;
+using System.Net.Mime;
using AutoMapper;
using Filtration.ObjectModel;
using Filtration.ViewModels;
@@ -17,28 +18,8 @@ namespace Filtration.Utilities
public ObservableCollection MapBlockGroupsToViewModels(
ObservableCollection blockGroups, bool showAdvanced)
{
-
- //Mapper.Reset();
- if (showAdvanced)
- {
- Mapper.CreateMap()
- .ForMember(dest => dest.IsChecked,
- opts => opts.MapFrom(from => from.IsChecked))
- .ForMember(dest => dest.SourceBlockGroup,
- opts => opts.MapFrom(from => from));
- }
- else
- {
- Mapper.CreateMap()
- .ForMember(dest => dest.IsChecked,
- opts => opts.MapFrom(from => from.IsChecked))
- .ForMember(dest => dest.ChildGroups,
- opts => opts.MapFrom(from => from.ChildGroups.Where(c => c.Advanced == false)))
- .ForMember(dest => dest.SourceBlockGroup,
- opts => opts.MapFrom(from => from));
- }
-
- var mappedViewModels = Mapper.Map>(blockGroups);
+
+ var mappedViewModels = Mapper.Map>(blockGroups, opts => opts.Items["showAdvanced"] = showAdvanced);
AutoMapperHelpers.ItemFilterBlockGroupViewModelPostMap(mappedViewModels.First());
return mappedViewModels.First().ChildGroups;
}
diff --git a/Filtration/Views/AvalonDock/AvalonDockWorkspaceView.xaml b/Filtration/Views/AvalonDock/AvalonDockWorkspaceView.xaml
index b53ee20..000a971 100644
--- a/Filtration/Views/AvalonDock/AvalonDockWorkspaceView.xaml
+++ b/Filtration/Views/AvalonDock/AvalonDockWorkspaceView.xaml
@@ -24,9 +24,9 @@
AllowMixedOrientation="True"
DocumentsSource="{Binding OpenDocuments}"
ActiveContent="{Binding ActiveDocument, Mode=TwoWay, Converter={StaticResource ActiveDocumentConverter}}" >
-
+
@@ -95,7 +95,6 @@
-
diff --git a/Filtration/Views/ItemFilterScriptView.xaml b/Filtration/Views/ItemFilterScriptView.xaml
index 7c06ffd..d6279ee 100644
--- a/Filtration/Views/ItemFilterScriptView.xaml
+++ b/Filtration/Views/ItemFilterScriptView.xaml
@@ -67,7 +67,7 @@
+
\ No newline at end of file
diff --git a/Filtration/Views/Styles/Colours.xaml b/Filtration/Views/Styles/Colours.xaml
new file mode 100644
index 0000000..64f483a
--- /dev/null
+++ b/Filtration/Views/Styles/Colours.xaml
@@ -0,0 +1,29 @@
+
+ #FF000000
+ #FFFFFFFF
+
+ #FF333333
+ #FF7F7F7F
+ #FF9D9D9D
+ #FFA59F93
+ #FFB9B9B9
+ #FFCCCCCC
+ #FFD8D8D9
+ #FFE0E0E0
+ #5EC9C9C9
+ #FFF7F7F7
+ #FFA9BDD8
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Filtration/Views/Styles/ListBoxItem.xaml b/Filtration/Views/Styles/ListBoxItem.xaml
new file mode 100644
index 0000000..871619e
--- /dev/null
+++ b/Filtration/Views/Styles/ListBoxItem.xaml
@@ -0,0 +1,49 @@
+
+
+
\ No newline at end of file
diff --git a/Filtration/Views/Styles/TreeViewItem.xaml b/Filtration/Views/Styles/TreeViewItem.xaml
new file mode 100644
index 0000000..a6d9f9b
--- /dev/null
+++ b/Filtration/Views/Styles/TreeViewItem.xaml
@@ -0,0 +1,156 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Filtration/Views/ToolPanes/BlockGroupBrowserView.xaml b/Filtration/Views/ToolPanes/BlockGroupBrowserView.xaml
index 2c3524c..aa9d1ef 100644
--- a/Filtration/Views/ToolPanes/BlockGroupBrowserView.xaml
+++ b/Filtration/Views/ToolPanes/BlockGroupBrowserView.xaml
@@ -24,7 +24,6 @@
-
@@ -33,7 +32,7 @@
-
+
diff --git a/Filtration/Views/ToolPanes/SectionBrowserView.xaml b/Filtration/Views/ToolPanes/SectionBrowserView.xaml
index 18482af..3e4d246 100644
--- a/Filtration/Views/ToolPanes/SectionBrowserView.xaml
+++ b/Filtration/Views/ToolPanes/SectionBrowserView.xaml
@@ -16,6 +16,9 @@
SelectedItem="{Binding SelectedSectionBlockViewModel}"
x:Name="SectionBrowserListBox"
ScrollViewer.HorizontalScrollBarVisibility="Hidden">
+
+
+