From 1b63f68eeebcdb07c90c73452a47b5cc6c9ceab9 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 6 Jul 2015 15:33:25 +0100 Subject: [PATCH] Fixed theme serialization/deserialization and added them toolbar icons --- Filtration.ObjectModel/ThemeEditor/Theme.cs | 3 ++ .../ThemeEditor/ThemeComponent.cs | 10 ++++- .../ViewModels/ThemeEditorViewModel.cs | 1 + .../Views/ThemeComponentControl.xaml | 42 +++++++++--------- .../Views/ThemeEditorView.xaml | 4 +- Filtration/Filtration.csproj | 2 + Filtration/Resources/Icons/Add.ico | Bin 0 -> 5430 bytes .../Resources/Icons/ThemeComponentDelete.ico | Bin 0 -> 5430 bytes Filtration/Views/IconsDictionary.xaml | 2 + Filtration/Views/MainWindow.xaml | 16 +++---- 10 files changed, 46 insertions(+), 34 deletions(-) create mode 100644 Filtration/Resources/Icons/Add.ico create mode 100644 Filtration/Resources/Icons/ThemeComponentDelete.ico diff --git a/Filtration.ObjectModel/ThemeEditor/Theme.cs b/Filtration.ObjectModel/ThemeEditor/Theme.cs index 954a2c8..91f2722 100644 --- a/Filtration.ObjectModel/ThemeEditor/Theme.cs +++ b/Filtration.ObjectModel/ThemeEditor/Theme.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Windows.Media; +using System.Xml.Serialization; using Filtration.ObjectModel.Enums; namespace Filtration.ObjectModel.ThemeEditor @@ -17,6 +18,8 @@ namespace Filtration.ObjectModel.ThemeEditor } public string Name { get; set; } + + [XmlIgnore] public string FilePath { get; set; } public ThemeComponentCollection Components diff --git a/Filtration.ObjectModel/ThemeEditor/ThemeComponent.cs b/Filtration.ObjectModel/ThemeEditor/ThemeComponent.cs index 27ab695..dcfbe11 100644 --- a/Filtration.ObjectModel/ThemeEditor/ThemeComponent.cs +++ b/Filtration.ObjectModel/ThemeEditor/ThemeComponent.cs @@ -2,6 +2,7 @@ using System.ComponentModel; using System.Runtime.CompilerServices; using System.Windows.Media; +using System.Xml.Serialization; using Filtration.ObjectModel.Annotations; using Filtration.ObjectModel.Enums; @@ -13,7 +14,12 @@ namespace Filtration.ObjectModel.ThemeEditor private Color _color; private EventHandler _themeComponentUpdatedEventHandler; private readonly object _eventLock = new object(); - + + public ThemeComponent() + { + + } + public ThemeComponent(ThemeComponentType componentType, string componentName, Color componentColor) { if (componentName == null || componentColor == null) @@ -51,7 +57,7 @@ namespace Filtration.ObjectModel.ThemeEditor public event EventHandler ThemeComponentDeleted; public string ComponentName { get; set; } - public ThemeComponentType ComponentType{ get; private set; } + public ThemeComponentType ComponentType{ get; set; } public Color Color { diff --git a/Filtration.ThemeEditor/ViewModels/ThemeEditorViewModel.cs b/Filtration.ThemeEditor/ViewModels/ThemeEditorViewModel.cs index 2c986b0..aab12ce 100644 --- a/Filtration.ThemeEditor/ViewModels/ThemeEditorViewModel.cs +++ b/Filtration.ThemeEditor/ViewModels/ThemeEditorViewModel.cs @@ -169,6 +169,7 @@ namespace Filtration.ThemeEditor.ViewModels FilePath = saveDialog.FileName; _themeProvider.SaveTheme(this, FilePath); _filenameIsFake = false; + Title = Filename; //RemoveDirtyFlag(); } catch (Exception e) diff --git a/Filtration.ThemeEditor/Views/ThemeComponentControl.xaml b/Filtration.ThemeEditor/Views/ThemeComponentControl.xaml index 76a7a5c..e4c5853 100644 --- a/Filtration.ThemeEditor/Views/ThemeComponentControl.xaml +++ b/Filtration.ThemeEditor/Views/ThemeComponentControl.xaml @@ -19,10 +19,6 @@ - - - - @@ -31,23 +27,25 @@ - - - - - - + + + + + + + +