diff --git a/Filtration/Filtration.csproj b/Filtration/Filtration.csproj
index d338b2f..5d3958f 100644
--- a/Filtration/Filtration.csproj
+++ b/Filtration/Filtration.csproj
@@ -148,6 +148,9 @@
EditableListBoxControl.xaml
+
+ ItemPreviewControl.xaml
+
@@ -183,6 +186,10 @@
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -203,7 +210,7 @@
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
diff --git a/Filtration/Models/BlockItemBaseTypes/BlockItembase.cs b/Filtration/Models/BlockItemBaseTypes/BlockItembase.cs
new file mode 100644
index 0000000..0a352c2
--- /dev/null
+++ b/Filtration/Models/BlockItemBaseTypes/BlockItembase.cs
@@ -0,0 +1,26 @@
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Windows.Media;
+using Filtration.Annotations;
+
+namespace Filtration.Models.BlockItemBaseTypes
+{
+ abstract class BlockItemBase : ILootFilterBlockItem
+ {
+ public abstract string PrefixText { get; }
+ public abstract int MaximumAllowed { get; }
+ public abstract string DisplayHeading { get; }
+ public abstract string SummaryText { get; }
+ public abstract Color SummaryBackgroundColor { get; }
+ public abstract Color SummaryTextColor { get; }
+ public abstract int SortOrder { get; }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ [NotifyPropertyChangedInvocator]
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ var handler = PropertyChanged;
+ if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+}
diff --git a/Filtration/UserControls/ItemPreviewControl.xaml b/Filtration/UserControls/ItemPreviewControl.xaml
new file mode 100644
index 0000000..a7d0822
--- /dev/null
+++ b/Filtration/UserControls/ItemPreviewControl.xaml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Filtration/UserControls/ItemPreviewControl.xaml.cs b/Filtration/UserControls/ItemPreviewControl.xaml.cs
new file mode 100644
index 0000000..b39eb8f
--- /dev/null
+++ b/Filtration/UserControls/ItemPreviewControl.xaml.cs
@@ -0,0 +1,74 @@
+using System.Windows;
+using System.Windows.Media;
+
+namespace Filtration.UserControls
+{
+ public partial class ItemPreviewControl
+ {
+ public ItemPreviewControl()
+ {
+ InitializeComponent();
+ // ReSharper disable once PossibleNullReferenceException
+ (Content as FrameworkElement).DataContext = this;
+ }
+
+ public static readonly DependencyProperty TextColorProperty = DependencyProperty.Register(
+ "TextColor",
+ typeof (Color),
+ typeof(ItemPreviewControl),
+ new FrameworkPropertyMetadata()
+ );
+
+ public static readonly DependencyProperty BackgroundColorProperty = DependencyProperty.Register(
+ "BackgroundColor",
+ typeof(Color),
+ typeof(ItemPreviewControl),
+ new FrameworkPropertyMetadata()
+ );
+
+ public static readonly DependencyProperty BorderColorProperty = DependencyProperty.Register(
+ "BorderColor",
+ typeof(Color),
+ typeof(ItemPreviewControl),
+ new FrameworkPropertyMetadata()
+ );
+
+ public Color TextColor
+ {
+ get { return (Color) GetValue(TextColorProperty); }
+ set { SetValue(TextColorProperty, value); }
+ }
+
+ public Color BackgroundColor
+ {
+ get { return (Color)GetValue(BackgroundColorProperty); }
+ set { SetValue(BackgroundColorProperty, value); }
+ }
+
+ public Color BorderColor
+ {
+ get { return (Color)GetValue(BorderColorProperty); }
+ set { SetValue(BorderColorProperty, value); }
+ }
+
+ //private static void OnItemPreviewControlPropertyChanged(DependencyObject source,
+ // DependencyPropertyChangedEventArgs e)
+ //{
+ // var control = source as ItemPreviewControl;
+ // if (control == null) return;
+
+ // control.OnPropertyChanged("TextColor");
+ // control.OnPropertyChanged("BackgroundColor");
+ // control.OnPropertyChanged("BorderColor");
+ //}
+
+ //public event PropertyChangedEventHandler PropertyChanged;
+
+ //[NotifyPropertyChangedInvocator]
+ //protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ //{
+ // var handler = PropertyChanged;
+ // if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
+ //}
+ }
+}
diff --git a/Filtration/ViewModels/ReplaceColorsViewModel.cs b/Filtration/ViewModels/ReplaceColorsViewModel.cs
index 9809e61..ec025ad 100644
--- a/Filtration/ViewModels/ReplaceColorsViewModel.cs
+++ b/Filtration/ViewModels/ReplaceColorsViewModel.cs
@@ -31,25 +31,28 @@ namespace Filtration.ViewModels
if (initialiseFromBlock.BlockItems.Count(b => b.GetType() == typeof (TextColorBlockItem)) > 0)
{
_replaceColorsParameterSet.ReplaceTextColor = true;
- _replaceColorsParameterSet.OldTextColor =
- ((TextColorBlockItem)
+ var existingBlockColor = ((TextColorBlockItem)
initialiseFromBlock.BlockItems.First(b => b.GetType() == typeof (TextColorBlockItem))).Color;
+ _replaceColorsParameterSet.OldTextColor = existingBlockColor;
+ _replaceColorsParameterSet.NewTextColor = existingBlockColor;
}
if (initialiseFromBlock.BlockItems.Count(b => b.GetType() == typeof(BackgroundColorBlockItem)) > 0)
{
_replaceColorsParameterSet.ReplaceBackgroundColor = true;
- _replaceColorsParameterSet.OldBackgroundColor =
- ((BackgroundColorBlockItem)
+ var existingBlockColor = ((BackgroundColorBlockItem)
initialiseFromBlock.BlockItems.First(b => b.GetType() == typeof(BackgroundColorBlockItem))).Color;
+ _replaceColorsParameterSet.OldBackgroundColor = existingBlockColor;
+ _replaceColorsParameterSet.NewBackgroundColor = existingBlockColor;
}
if (initialiseFromBlock.BlockItems.Count(b => b.GetType() == typeof(BorderColorBlockItem)) > 0)
{
_replaceColorsParameterSet.ReplaceBorderColor = true;
- _replaceColorsParameterSet.OldBorderColor =
- ((BorderColorBlockItem)
+ var existingBlockColor = ((BorderColorBlockItem)
initialiseFromBlock.BlockItems.First(b => b.GetType() == typeof(BorderColorBlockItem))).Color;
+ _replaceColorsParameterSet.OldBorderColor = existingBlockColor;
+ _replaceColorsParameterSet.NewBorderColor = existingBlockColor;
}
_lootFilterScript = lootFilterScript;
diff --git a/Filtration/Views/LootFilterBlockDisplaySettingsView.xaml b/Filtration/Views/LootFilterBlockDisplaySettingsView.xaml
index 34e78d2..3dcdcdb 100644
--- a/Filtration/Views/LootFilterBlockDisplaySettingsView.xaml
+++ b/Filtration/Views/LootFilterBlockDisplaySettingsView.xaml
@@ -15,7 +15,7 @@
-
+
diff --git a/Filtration/Views/LootFilterBlockView.xaml b/Filtration/Views/LootFilterBlockView.xaml
index 52f7083..e9bc2b1 100644
--- a/Filtration/Views/LootFilterBlockView.xaml
+++ b/Filtration/Views/LootFilterBlockView.xaml
@@ -10,14 +10,13 @@
xmlns:blockItemTypes="clr-namespace:Filtration.Models.BlockItemTypes"
xmlns:enums="clr-namespace:Filtration.Enums"
xmlns:extensions="clr-namespace:Filtration.Extensions"
- xmlns:models="clr-namespace:Filtration.Models"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=viewModels:LootFilterBlockViewModel}"
d:DesignHeight="200" d:DesignWidth="800">
-
+
@@ -74,9 +73,6 @@
-
-
-
@@ -89,7 +85,6 @@
-
@@ -104,19 +99,7 @@
x:Name="ItemPreviewButton"
IsChecked="{Binding DisplaySettingsPopupOpen, Mode=OneWayToSource}"
ToolTip="Click here to change color and font settings" Cursor="Hand" >
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/Filtration/Views/ReplaceColorsWindow.xaml b/Filtration/Views/ReplaceColorsWindow.xaml
index 713b651..8100b9b 100644
--- a/Filtration/Views/ReplaceColorsWindow.xaml
+++ b/Filtration/Views/ReplaceColorsWindow.xaml
@@ -6,6 +6,7 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
+ xmlns:userControls="clr-namespace:Filtration.UserControls"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=viewModels:ReplaceColorsViewModel}"
ShowMaxRestoreButton="False"
@@ -15,7 +16,7 @@
-
+
@@ -56,19 +57,7 @@
New Border Color
-
-
-
-
-
-
-
-
-
-
-
-
-
+
Preview
diff --git a/Filtration/Views/LootFilterBlockViewDictionary.xaml b/Filtration/Views/SharedResourcesDictionary.xaml
similarity index 100%
rename from Filtration/Views/LootFilterBlockViewDictionary.xaml
rename to Filtration/Views/SharedResourcesDictionary.xaml