Implemented C# 6.0 features, fixed most of resharper's code quality suggestions.

This commit is contained in:
Ben Wallis 2015-12-13 20:17:15 +00:00
parent 9a117d118f
commit 2dc56799fd
70 changed files with 409 additions and 1259 deletions

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following

View File

@ -13,10 +13,7 @@ namespace Filtration.Common.Converters
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{ {
if (value != null) return ((SolidColorBrush) value)?.Color;
return ((SolidColorBrush)value).Color;
return null;
} }
} }
} }

View File

@ -1,10 +1,4 @@
using System; namespace Filtration.Common.Messages
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Filtration.Common.Messages
{ {
class ThemeClosedMessage class ThemeClosedMessage
{ {

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following

View File

@ -9,7 +9,7 @@ namespace Filtration.ObjectModel.Tests
public void ToString_ReturnsFullBlockHierarchy() public void ToString_ReturnsFullBlockHierarchy()
{ {
// Arrange // Arrange
const string ExpectedResult = "Child 1 Block Group - Child 2 Block Group"; const string expectedResult = "Child 1 Block Group - Child 2 Block Group";
var rootBlockGroup = new ItemFilterBlockGroup("Root Block Group", null); var rootBlockGroup = new ItemFilterBlockGroup("Root Block Group", null);
var child1BlockGroup = new ItemFilterBlockGroup("Child 1 Block Group", rootBlockGroup); var child1BlockGroup = new ItemFilterBlockGroup("Child 1 Block Group", rootBlockGroup);
@ -19,14 +19,14 @@ namespace Filtration.ObjectModel.Tests
var result = child2BlockGroup.ToString(); var result = child2BlockGroup.ToString();
// Assert // Assert
Assert.AreEqual(ExpectedResult, result); Assert.AreEqual(expectedResult, result);
} }
[Test] [Test]
public void ToString_AddsTildeForAdvancedBlock() public void ToString_AddsTildeForAdvancedBlock()
{ {
// Arrange // Arrange
const string ExpectedResult = "~Child 1 Block Group - Child 2 Block Group"; const string expectedResult = "~Child 1 Block Group - Child 2 Block Group";
var rootBlockGroup = new ItemFilterBlockGroup("Root Block Group", null); var rootBlockGroup = new ItemFilterBlockGroup("Root Block Group", null);
var child1BlockGroup = new ItemFilterBlockGroup("Child 1 Block Group", rootBlockGroup, true); var child1BlockGroup = new ItemFilterBlockGroup("Child 1 Block Group", rootBlockGroup, true);
@ -36,7 +36,7 @@ namespace Filtration.ObjectModel.Tests
var result = child2BlockGroup.ToString(); var result = child2BlockGroup.ToString();
// Assert // Assert
Assert.AreEqual(ExpectedResult, result); Assert.AreEqual(expectedResult, result);
} }
} }
} }

View File

@ -26,54 +26,21 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
} }
} }
public override string OutputText public override string OutputText => Action.GetAttributeDescription();
{
get { return Action.GetAttributeDescription(); }
}
public override string PrefixText public override string PrefixText => string.Empty;
{
get { return string.Empty; }
}
public override int MaximumAllowed public override int MaximumAllowed => 1;
{
get { return 1; }
}
public override string DisplayHeading public override string DisplayHeading => "Action";
{
get
{
return "Action";
}
}
public override string SummaryText public override string SummaryText => Action == BlockAction.Show ? "Show" : "Hide";
{
get
{
return Action == BlockAction.Show ? "Show" : "Hide";
}
}
public override Color SummaryBackgroundColor public override Color SummaryBackgroundColor => Action == BlockAction.Show ? Colors.LimeGreen : Colors.OrangeRed;
{
get
{
return Action == BlockAction.Show ? Colors.LimeGreen : Colors.OrangeRed;
}
}
public override Color SummaryTextColor public override Color SummaryTextColor => Action == BlockAction.Show ? Colors.Black : Colors.White;
{
get
{
return Action == BlockAction.Show ? Colors.Black : Colors.White;
}
}
public override int SortOrder { get { return 0; } } public override int SortOrder => 0;
public void ToggleAction() public void ToggleAction()
{ {

View File

@ -22,7 +22,7 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{ {
var handler = PropertyChanged; var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
} }
} }

View File

@ -18,20 +18,11 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
Color = color; Color = color;
} }
public override string OutputText public override string OutputText => PrefixText + " " + +Color.R + " " + Color.G + " "
{
get
{
return PrefixText + " " + +Color.R + " " + Color.G + " "
+ Color.B + (Color.A < 255 ? " " + Color.A : string.Empty) + + Color.B + (Color.A < 255 ? " " + Color.A : string.Empty) +
(ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty); (ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty);
}
}
public override string SummaryText public override string SummaryText => string.Empty;
{
get { return string.Empty; }
}
public ThemeComponent ThemeComponent public ThemeComponent ThemeComponent
{ {
@ -56,8 +47,8 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
} }
} }
public override Color SummaryBackgroundColor { get { return Colors.Transparent; } } public override Color SummaryBackgroundColor => Colors.Transparent;
public override Color SummaryTextColor { get { return Colors.Transparent; } } public override Color SummaryTextColor => Colors.Transparent;
public Color Color public Color Color
{ {

View File

@ -17,14 +17,11 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
SecondValue = secondValue; SecondValue = secondValue;
} }
public override string OutputText public override string OutputText => PrefixText + " " + Value + " " + SecondValue;
{
get { return PrefixText + " " + Value + " " + SecondValue; }
}
public override string SummaryText { get { return string.Empty; } } public override string SummaryText => string.Empty;
public override Color SummaryBackgroundColor { get { return Colors.Transparent; } } public override Color SummaryBackgroundColor => Colors.Transparent;
public override Color SummaryTextColor { get { return Colors.Transparent; } } public override Color SummaryTextColor => Colors.Transparent;
public int Value public int Value
{ {

View File

@ -15,14 +15,11 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
Value = value; Value = value;
} }
public override string OutputText public override string OutputText => PrefixText + " " + Value;
{
get { return PrefixText + " " + Value; }
}
public override string SummaryText { get { return string.Empty; } } public override string SummaryText => string.Empty;
public override Color SummaryBackgroundColor { get { return Colors.Transparent; } } public override Color SummaryBackgroundColor => Colors.Transparent;
public override Color SummaryTextColor { get { return Colors.Transparent; } } public override Color SummaryTextColor => Colors.Transparent;
public abstract int Minimum { get; } public abstract int Minimum { get; }
public abstract int Maximum { get; } public abstract int Maximum { get; }

View File

@ -20,14 +20,8 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
FilterPredicate.PropertyChanged += OnFilterPredicateChanged; FilterPredicate.PropertyChanged += OnFilterPredicateChanged;
} }
public override string OutputText public override string OutputText => PrefixText + " " + FilterPredicate.PredicateOperator.GetAttributeDescription() +
{
get
{
return PrefixText + " " + FilterPredicate.PredicateOperator.GetAttributeDescription() +
" " + FilterPredicate.PredicateOperand; " " + FilterPredicate.PredicateOperand;
}
}
public abstract int Minimum { get; } public abstract int Minimum { get; }
public abstract int Maximum { get; } public abstract int Maximum { get; }

View File

@ -21,8 +21,7 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
if (enumerable.Count > 0) if (enumerable.Count > 0)
{ {
return PrefixText + " " + return PrefixText + " " +
string.Format("\"{0}\"", $"\"{string.Join("\" \"", enumerable.ToArray())}\"";
string.Join("\" \"", enumerable.ToArray()));
} }
return string.Empty; return string.Empty;

View File

@ -13,27 +13,9 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
} }
public override string PrefixText public override string PrefixText => "SetBackgroundColor";
{ public override int MaximumAllowed => 1;
get { return "SetBackgroundColor"; } public override string DisplayHeading => "Background Color";
} public override int SortOrder => 13;
public override int MaximumAllowed
{
get { return 1; }
}
public override string DisplayHeading
{
get
{
return "Background Color";
}
}
public override int SortOrder
{
get { return 13; }
}
} }
} }

View File

@ -6,20 +6,9 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
public class BaseTypeBlockItem : StringListBlockItem public class BaseTypeBlockItem : StringListBlockItem
{ {
public override string PrefixText { get { return "BaseType"; } } public override string PrefixText => "BaseType";
public override int MaximumAllowed => 1;
public override int MaximumAllowed public override string DisplayHeading => "Base Type";
{
get { return 1; }
}
public override string DisplayHeading
{
get
{
return "Base Type";
}
}
public override string SummaryText public override string SummaryText
{ {
@ -42,19 +31,8 @@ namespace Filtration.ObjectModel.BlockItemTypes
} }
} }
public override Color SummaryBackgroundColor public override Color SummaryBackgroundColor => Colors.MediumTurquoise;
{ public override Color SummaryTextColor => Colors.Black;
get { return Colors.MediumTurquoise; } public override int SortOrder => 11;
}
public override Color SummaryTextColor
{
get { return Colors.Black; }
}
public override int SortOrder
{
get { return 11; }
}
} }
} }

View File

@ -13,27 +13,9 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
} }
public override string PrefixText public override string PrefixText => "SetBorderColor";
{ public override int MaximumAllowed => 1;
get { return "SetBorderColor"; } public override string DisplayHeading => "Border Color";
} public override int SortOrder => 14;
public override int MaximumAllowed
{
get { return 1; }
}
public override string DisplayHeading
{
get
{
return "Border Color";
}
}
public override int SortOrder
{
get { return 14; }
}
} }
} }

View File

@ -6,14 +6,9 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
public class ClassBlockItem : StringListBlockItem public class ClassBlockItem : StringListBlockItem
{ {
public override string PrefixText { get { return "Class"; } } public override string PrefixText => "Class";
public override int MaximumAllowed => 1;
public override int MaximumAllowed public override string DisplayHeading => "Class";
{
get { return 1; }
}
public override string DisplayHeading { get { return "Class"; } }
public override string SummaryText public override string SummaryText
{ {
@ -36,19 +31,8 @@ namespace Filtration.ObjectModel.BlockItemTypes
} }
} }
public override Color SummaryBackgroundColor public override Color SummaryBackgroundColor => Colors.MediumSeaGreen;
{ public override Color SummaryTextColor => Colors.White;
get { return Colors.MediumSeaGreen; } public override int SortOrder => 10;
}
public override Color SummaryTextColor
{
get { return Colors.White; }
}
public override int SortOrder
{
get { return 10; }
}
} }
} }

View File

@ -15,58 +15,14 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
} }
public override string PrefixText public override string PrefixText => "DropLevel";
{ public override int MaximumAllowed => 2;
get { return "DropLevel"; } public override string DisplayHeading => "Drop Level";
} public override string SummaryText => "Drop Level " + FilterPredicate;
public override Color SummaryBackgroundColor => Colors.DodgerBlue;
public override int MaximumAllowed public override Color SummaryTextColor => Colors.White;
{ public override int SortOrder => 2;
get { return 2; } public override int Minimum => 0;
} public override int Maximum => 100;
public override string DisplayHeading
{
get
{
return "Drop Level";
}
}
public override string SummaryText
{
get { return "Drop Level " + FilterPredicate; }
}
public override Color SummaryBackgroundColor
{
get { return Colors.DodgerBlue; }
}
public override Color SummaryTextColor
{
get { return Colors.White; }
}
public override int SortOrder
{
get { return 2; }
}
public override int Minimum
{
get
{
return 0;
}
}
public override int Maximum
{
get
{
return 100;
}
}
} }
} }

View File

@ -13,43 +13,11 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
} }
public override string PrefixText public override string PrefixText => "SetFontSize";
{ public override int MaximumAllowed => 1;
get { return "SetFontSize"; } public override string DisplayHeading => "Font Size";
} public override int SortOrder => 15;
public override int Minimum => 11;
public override int MaximumAllowed public override int Maximum => 45;
{
get { return 1; }
}
public override string DisplayHeading
{
get
{
return "Font Size";
}
}
public override int SortOrder
{
get { return 15; }
}
public override int Minimum
{
get
{
return 11;
}
}
public override int Maximum
{
get
{
return 45;
}
}
} }
} }

View File

@ -15,55 +15,14 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
} }
public override string PrefixText public override string PrefixText => "Height";
{ public override int MaximumAllowed => 2;
get { return "Height"; } public override string DisplayHeading => "Height";
} public override string SummaryText => "Height " + FilterPredicate;
public override Color SummaryBackgroundColor => Colors.LightBlue;
public override int MaximumAllowed public override Color SummaryTextColor => Colors.Black;
{ public override int SortOrder => 8;
get { return 2; } public override int Minimum => 0;
} public override int Maximum => 6;
public override string DisplayHeading
{
get { return "Height"; }
}
public override string SummaryText
{
get { return "Height " + FilterPredicate; }
}
public override Color SummaryBackgroundColor
{
get { return Colors.LightBlue; }
}
public override Color SummaryTextColor
{
get { return Colors.Black; }
}
public override int SortOrder
{
get { return 8; }
}
public override int Minimum
{
get
{
return 0;
}
}
public override int Maximum
{
get
{
return 6;
}
}
} }
} }

View File

@ -14,58 +14,14 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
} }
public override string PrefixText public override string PrefixText => "ItemLevel";
{ public override int MaximumAllowed => 2;
get { return "ItemLevel"; } public override string DisplayHeading => "Item Level";
} public override string SummaryText => "Item Level " + FilterPredicate;
public override Color SummaryBackgroundColor => Colors.DarkSlateGray;
public override int MaximumAllowed public override Color SummaryTextColor => Colors.White;
{ public override int SortOrder => 1;
get { return 2; } public override int Minimum => 0;
} public override int Maximum => 100;
public override string DisplayHeading
{
get
{
return "Item Level";
}
}
public override string SummaryText
{
get { return "Item Level " + FilterPredicate; }
}
public override Color SummaryBackgroundColor
{
get { return Colors.DarkSlateGray; }
}
public override Color SummaryTextColor
{
get { return Colors.White; }
}
public override int SortOrder
{
get { return 1; }
}
public override int Minimum
{
get
{
return 0;
}
}
public override int Maximum
{
get
{
return 100;
}
}
} }
} }

View File

@ -15,58 +15,14 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
} }
public override string PrefixText public override string PrefixText => "LinkedSockets";
{ public override int MaximumAllowed => 2;
get { return "LinkedSockets"; } public override string DisplayHeading => "Linked Sockets";
} public override string SummaryText => "Linked Sockets " + FilterPredicate;
public override Color SummaryBackgroundColor => Colors.Gold;
public override int MaximumAllowed public override Color SummaryTextColor => Colors.Black;
{ public override int SortOrder => 6;
get { return 2; } public override int Minimum => 0;
} public override int Maximum => 6;
public override string DisplayHeading
{
get
{
return "Linked Sockets";
}
}
public override string SummaryText
{
get { return "Linked Sockets " + FilterPredicate; }
}
public override Color SummaryBackgroundColor
{
get { return Colors.Gold; }
}
public override Color SummaryTextColor
{
get { return Colors.Black; }
}
public override int SortOrder
{
get { return 6; }
}
public override int Minimum
{
get
{
return 0;
}
}
public override int Maximum
{
get
{
return 6;
}
}
} }
} }

View File

@ -15,58 +15,14 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
} }
public override string PrefixText public override string PrefixText => "Quality";
{ public override int MaximumAllowed => 2;
get { return "Quality"; } public override string DisplayHeading => "Quality";
} public override string SummaryText => "Quality " + FilterPredicate;
public override Color SummaryBackgroundColor => Colors.DarkOrange;
public override int MaximumAllowed public override Color SummaryTextColor => Colors.White;
{ public override int SortOrder => 3;
get { return 2; } public override int Minimum => 0;
} public override int Maximum => 20;
public override string DisplayHeading
{
get
{
return "Quality";
}
}
public override string SummaryText
{
get { return "Quality " + FilterPredicate; }
}
public override Color SummaryBackgroundColor
{
get { return Colors.DarkOrange; }
}
public override Color SummaryTextColor
{
get { return Colors.White; }
}
public override int SortOrder
{
get { return 3; }
}
public override int Minimum
{
get
{
return 0;
}
}
public override int Maximum
{
get
{
return 20;
}
}
} }
} }

View File

@ -16,74 +16,17 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
} }
public override string PrefixText public override string PrefixText => "Rarity";
{ public override string OutputText => PrefixText + " " + FilterPredicate.PredicateOperator
get { return "Rarity"; } .GetAttributeDescription() + " " + ((ItemRarity) FilterPredicate.PredicateOperand).GetAttributeDescription();
} public override int MaximumAllowed => 2;
public override string DisplayHeading => "Item Rarity";
public override string OutputText public override string SummaryText => "Rarity " + FilterPredicate.PredicateOperator.GetAttributeDescription() + " " +
{
get
{
return PrefixText + " " + FilterPredicate.PredicateOperator
.GetAttributeDescription() +
" " +
((ItemRarity) FilterPredicate.PredicateOperand)
.GetAttributeDescription();
}
}
public override int MaximumAllowed
{
get { return 2; }
}
public override string DisplayHeading
{
get
{
return "Item Rarity";
}
}
public override string SummaryText
{
get
{
return "Rarity " + FilterPredicate.PredicateOperator.GetAttributeDescription() + " " +
((ItemRarity) FilterPredicate.PredicateOperand).GetAttributeDescription(); ((ItemRarity) FilterPredicate.PredicateOperand).GetAttributeDescription();
} public override Color SummaryBackgroundColor => Colors.LightCoral;
} public override Color SummaryTextColor => Colors.White;
public override int SortOrder => 4;
public override Color SummaryBackgroundColor public override int Minimum => 0;
{ public override int Maximum => (int)ItemRarity.Unique;
get { return Colors.LightCoral; }
}
public override Color SummaryTextColor
{
get { return Colors.White; }
}
public override int SortOrder
{
get { return 4; }
}
public override int Minimum
{
get
{
return 0;
}
}
public override int Maximum
{
get
{
return (int)ItemRarity.Unique;
}
}
} }
} }

View File

@ -6,24 +6,9 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
public class SocketGroupBlockItem : StringListBlockItem public class SocketGroupBlockItem : StringListBlockItem
{ {
public override string PrefixText public override string PrefixText => "SocketGroup";
{ public override int MaximumAllowed => 1;
get { return "SocketGroup"; } public override string DisplayHeading => "Socket Group";
}
public override int MaximumAllowed
{
get { return 1; }
}
public override string DisplayHeading
{
get
{
return "Socket Group";
}
}
public override string SummaryText public override string SummaryText
{ {
get get
@ -32,20 +17,8 @@ namespace Filtration.ObjectModel.BlockItemTypes
return "Socket Group " + summaryItemText.TrimStart(' '); return "Socket Group " + summaryItemText.TrimStart(' ');
} }
} }
public override Color SummaryBackgroundColor => Colors.GhostWhite;
public override Color SummaryBackgroundColor public override Color SummaryTextColor => Colors.Black;
{ public override int SortOrder => 9;
get { return Colors.GhostWhite; }
}
public override Color SummaryTextColor
{
get { return Colors.Black; }
}
public override int SortOrder
{
get { return 9; }
}
} }
} }

View File

@ -15,58 +15,14 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
} }
public override string PrefixText public override string PrefixText => "Sockets";
{ public override int MaximumAllowed => 2;
get { return "Sockets"; } public override string DisplayHeading => "Sockets";
} public override string SummaryText => "Sockets " + FilterPredicate;
public override Color SummaryBackgroundColor => Colors.LightGray;
public override int MaximumAllowed public override Color SummaryTextColor => Colors.Black;
{ public override int SortOrder => 5;
get { return 2; } public override int Minimum => 0;
} public override int Maximum => 6;
public override string DisplayHeading
{
get
{
return "Sockets";
}
}
public override string SummaryText
{
get { return "Sockets " + FilterPredicate; }
}
public override Color SummaryBackgroundColor
{
get { return Colors.LightGray; }
}
public override Color SummaryTextColor
{
get { return Colors.Black; }
}
public override int SortOrder
{
get { return 5; }
}
public override int Minimum
{
get
{
return 0;
}
}
public override int Maximum
{
get
{
return 6;
}
}
} }
} }

View File

@ -14,27 +14,9 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
} }
public override string PrefixText public override string PrefixText => "PlayAlertSound";
{ public override int MaximumAllowed => 1;
get { return "PlayAlertSound"; } public override string DisplayHeading => "Play Alert Sound";
} public override int SortOrder => 16;
public override int MaximumAllowed
{
get { return 1; }
}
public override string DisplayHeading
{
get
{
return "Play Alert Sound";
}
}
public override int SortOrder
{
get { return 16; }
}
} }
} }

View File

@ -13,27 +13,9 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
} }
public override string PrefixText public override string PrefixText => "SetTextColor";
{ public override int MaximumAllowed => 1;
get { return "SetTextColor"; } public override string DisplayHeading => "Text Color";
} public override int SortOrder => 12;
public override int MaximumAllowed
{
get { return 1; }
}
public override string DisplayHeading
{
get
{
return "Text Color";
}
}
public override int SortOrder
{
get { return 12; }
}
} }
} }

View File

@ -15,58 +15,14 @@ namespace Filtration.ObjectModel.BlockItemTypes
{ {
} }
public override string PrefixText public override string PrefixText => "Width";
{ public override int MaximumAllowed => 2;
get { return "Width"; } public override string DisplayHeading => "Width";
} public override string SummaryText => "Width " + FilterPredicate;
public override Color SummaryBackgroundColor => Colors.MediumPurple;
public override int MaximumAllowed public override Color SummaryTextColor => Colors.White;
{ public override int SortOrder => 7;
get { return 2; } public override int Minimum => 0;
} public override int Maximum => 2;
public override string DisplayHeading
{
get
{
return "Width";
}
}
public override string SummaryText
{
get { return "Width " + FilterPredicate; }
}
public override Color SummaryBackgroundColor
{
get { return Colors.MediumPurple; }
}
public override Color SummaryTextColor
{
get { return Colors.White; }
}
public override int SortOrder
{
get { return 7; }
}
public override int Minimum
{
get
{
return 0;
}
}
public override int Maximum
{
get
{
return 2;
}
}
} }
} }

View File

@ -10,7 +10,7 @@ namespace Filtration.ObjectModel.Extensions
var type = enumVal.GetType(); var type = enumVal.GetType();
var memInfo = type.GetMember(enumVal.ToString()); var memInfo = type.GetMember(enumVal.ToString());
var attributes = memInfo[0].GetCustomAttributes(typeof(T), false); var attributes = memInfo[0].GetCustomAttributes(typeof(T), false);
return (attributes.Length > 0) ? (T)attributes[0] : null; return attributes.Length > 0 ? (T)attributes[0] : null;
} }
public static string GetAttributeDescription(this Enum enumValue) public static string GetAttributeDescription(this Enum enumValue)

View File

@ -59,11 +59,11 @@ namespace Filtration.ObjectModel
} }
} }
public ObservableCollection<IItemFilterBlockItem> BlockItems { get; private set; } public ObservableCollection<IItemFilterBlockItem> BlockItems { get; }
public int BlockCount(Type type) public int BlockCount(Type type)
{ {
return BlockItems != null ? BlockItems.Count(b => b.GetType() == type) : 0; return BlockItems?.Count(b => b.GetType() == type) ?? 0;
} }
public bool AddBlockItemAllowed(Type type) public bool AddBlockItemAllowed(Type type)

View File

@ -17,10 +17,10 @@ namespace Filtration.ObjectModel
public event EventHandler BlockGroupStatusChanged; public event EventHandler BlockGroupStatusChanged;
public string GroupName { get; private set; } public string GroupName { get; }
public ItemFilterBlockGroup ParentGroup { get; private set; } public ItemFilterBlockGroup ParentGroup { get; }
public List<ItemFilterBlockGroup> ChildGroups { get; private set; } public List<ItemFilterBlockGroup> ChildGroups { get; }
public bool Advanced { get; private set; } public bool Advanced { get; }
public bool IsChecked public bool IsChecked
{ {
@ -32,10 +32,7 @@ namespace Filtration.ObjectModel
_isChecked = value; _isChecked = value;
// Raise an event to let blocks that have this block group assigned that // Raise an event to let blocks that have this block group assigned that
// they might need to change their Action due to the block group status changing. // they might need to change their Action due to the block group status changing.
if (BlockGroupStatusChanged != null) BlockGroupStatusChanged?.Invoke(null, null);
{
BlockGroupStatusChanged.Invoke(null, null);
}
} }
} }
} }

View File

@ -19,8 +19,8 @@ namespace Filtration.ObjectModel
ThemeComponents = new ThemeComponentCollection { IsMasterCollection = true}; ThemeComponents = new ThemeComponentCollection { IsMasterCollection = true};
} }
public ObservableCollection<ItemFilterBlock> ItemFilterBlocks { get; private set; } public ObservableCollection<ItemFilterBlock> ItemFilterBlocks { get; }
public ObservableCollection<ItemFilterBlockGroup> ItemFilterBlockGroups { get; private set; } public ObservableCollection<ItemFilterBlockGroup> ItemFilterBlockGroups { get; }
public ThemeComponentCollection ThemeComponents { get; set; } public ThemeComponentCollection ThemeComponents { get; set; }

View File

@ -53,7 +53,7 @@ namespace Filtration.ObjectModel
public virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) public virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{ {
var handler = PropertyChanged; var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
} }
} }

View File

@ -1,5 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Windows.Media; using System.Windows.Media;
using System.Xml.Serialization; using System.Xml.Serialization;
@ -22,10 +21,7 @@ namespace Filtration.ObjectModel.ThemeEditor
[XmlIgnore] [XmlIgnore]
public string FilePath { get; set; } public string FilePath { get; set; }
public ThemeComponentCollection Components public ThemeComponentCollection Components => _components;
{
get { return _components; }
}
public bool ComponentExists(ThemeComponentType componentType, string componentName) public bool ComponentExists(ThemeComponentType componentType, string componentName)
{ {

View File

@ -2,7 +2,6 @@
using System.ComponentModel; using System.ComponentModel;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Windows.Media; using System.Windows.Media;
using System.Xml.Serialization;
using Filtration.ObjectModel.Annotations; using Filtration.ObjectModel.Annotations;
using Filtration.ObjectModel.Enums; using Filtration.ObjectModel.Enums;
@ -66,10 +65,7 @@ namespace Filtration.ObjectModel.ThemeEditor
{ {
_color = value; _color = value;
OnPropertyChanged(); OnPropertyChanged();
if (_themeComponentUpdatedEventHandler != null) _themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
{
_themeComponentUpdatedEventHandler.Invoke(this, EventArgs.Empty);
}
} }
} }
@ -88,10 +84,7 @@ namespace Filtration.ObjectModel.ThemeEditor
public void TerminateComponent() public void TerminateComponent()
{ {
if (ThemeComponentDeleted != null) ThemeComponentDeleted?.Invoke(this, EventArgs.Empty);
{
ThemeComponentDeleted.Invoke(this, EventArgs.Empty);
}
} }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
@ -100,7 +93,7 @@ namespace Filtration.ObjectModel.ThemeEditor
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{ {
var handler = PropertyChanged; var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
} }
} }

View File

@ -16,20 +16,20 @@ namespace Filtration.Tests.Services
public async Task LoadItemFilterScript_CallsTranslatorAndFileSystemService() public async Task LoadItemFilterScript_CallsTranslatorAndFileSystemService()
{ {
// Arrange // Arrange
const string TestInputPath = "C:\\Test Path\\Script.Filter"; const string testInputPath = "C:\\Test Path\\Script.Filter";
const string TestScriptString = "This is a test item filter script"; const string testScriptString = "This is a test item filter script";
var testItemFilterScript = new ItemFilterScript(); var testItemFilterScript = new ItemFilterScript();
var mockFileSystemService = new Mock<IFileSystemService>(); var mockFileSystemService = new Mock<IFileSystemService>();
mockFileSystemService.Setup(s => s.ReadFileAsString(TestInputPath)).Returns(TestScriptString).Verifiable(); mockFileSystemService.Setup(s => s.ReadFileAsString(testInputPath)).Returns(testScriptString).Verifiable();
var mockItemFilterScriptTranslator = new Mock<IItemFilterScriptTranslator>(); var mockItemFilterScriptTranslator = new Mock<IItemFilterScriptTranslator>();
mockItemFilterScriptTranslator.Setup(t => t.TranslateStringToItemFilterScript(TestScriptString)).Returns(testItemFilterScript).Verifiable(); mockItemFilterScriptTranslator.Setup(t => t.TranslateStringToItemFilterScript(testScriptString)).Returns(testItemFilterScript).Verifiable();
var service = new ItemFilterPersistenceService(mockFileSystemService.Object, mockItemFilterScriptTranslator.Object); var service = new ItemFilterPersistenceService(mockFileSystemService.Object, mockItemFilterScriptTranslator.Object);
// Act // Act
var script = await service.LoadItemFilterScriptAsync(TestInputPath); var script = await service.LoadItemFilterScriptAsync(testInputPath);
// Assert // Assert
mockFileSystemService.Verify(); mockFileSystemService.Verify();
@ -65,12 +65,12 @@ namespace Filtration.Tests.Services
public void DefaultPathOfExileDirectoryExists_CallsFileSystemServiceWithCorrectString() public void DefaultPathOfExileDirectoryExists_CallsFileSystemServiceWithCorrectString()
{ {
// Arrange // Arrange
const string TestUserProfilePath = "C:\\Users\\TestUser"; const string testUserProfilePath = "C:\\Users\\TestUser";
var mockFileSystemService = new Mock<IFileSystemService>(); var mockFileSystemService = new Mock<IFileSystemService>();
mockFileSystemService.Setup(f => f.GetUserProfilePath()).Returns(TestUserProfilePath).Verifiable(); mockFileSystemService.Setup(f => f.GetUserProfilePath()).Returns(testUserProfilePath).Verifiable();
mockFileSystemService.Setup(f => f.DirectoryExists(TestUserProfilePath + "\\Documents\\My Games\\Path of Exile")).Returns(true).Verifiable(); mockFileSystemService.Setup(f => f.DirectoryExists(testUserProfilePath + "\\Documents\\My Games\\Path of Exile")).Returns(true).Verifiable();
var mockItemFilterScriptTranslator = new Mock<IItemFilterScriptTranslator>(); var mockItemFilterScriptTranslator = new Mock<IItemFilterScriptTranslator>();

View File

@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Filtration.Models; using Filtration.Models;
using Filtration.Services; using Filtration.Services;
using Moq; using Moq;

View File

@ -600,15 +600,15 @@ namespace Filtration.Tests.Translators
public void TranslateStringToItemFilterBlock_SectionComment_ReturnsItemFilterSectionObjectWithCorrectDescription() public void TranslateStringToItemFilterBlock_SectionComment_ReturnsItemFilterSectionObjectWithCorrectDescription()
{ {
// Arrange // Arrange
const string TestInputSectionDescription = "Wonderful items that you definitely won't want to miss!"; const string testInputSectionDescription = "Wonderful items that you definitely won't want to miss!";
var inputString = "# Section: " + TestInputSectionDescription; var inputString = "# Section: " + testInputSectionDescription;
// Act // Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null); var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
// Assert // Assert
Assert.IsInstanceOf<ItemFilterSection>(result); Assert.IsInstanceOf<ItemFilterSection>(result);
Assert.AreEqual(TestInputSectionDescription, result.Description); Assert.AreEqual(testInputSectionDescription, result.Description);
} }
[Test] [Test]
@ -1282,10 +1282,10 @@ namespace Filtration.Tests.Translators
public void TranslateItemFilterBlockToString_Section_ReturnsCorrectString() public void TranslateItemFilterBlockToString_Section_ReturnsCorrectString()
{ {
// Arrange // Arrange
const string TestInputSectionText = "Ermagerd it's a section!"; const string testInputSectionText = "Ermagerd it's a section!";
var expectedResult = "# Section: " + TestInputSectionText; var expectedResult = "# Section: " + testInputSectionText;
_testUtility.TestBlock = new ItemFilterSection { Description = TestInputSectionText }; _testUtility.TestBlock = new ItemFilterSection { Description = testInputSectionText };
// Act // Act
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock); var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
@ -1559,8 +1559,8 @@ namespace Filtration.Tests.Translators
} }
public ItemFilterBlock TestBlock { get; set; } public ItemFilterBlock TestBlock { get; set; }
public Mock<IBlockGroupHierarchyBuilder> MockBlockGroupHierarchyBuilder { get; private set; } public Mock<IBlockGroupHierarchyBuilder> MockBlockGroupHierarchyBuilder { get; }
public ItemFilterBlockTranslator Translator { get; private set; } public ItemFilterBlockTranslator Translator { get; }
} }
} }
} }

View File

@ -2,7 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Windows;
using Filtration.ObjectModel; using Filtration.ObjectModel;
using Filtration.ObjectModel.BlockItemTypes; using Filtration.ObjectModel.BlockItemTypes;
using Filtration.ObjectModel.Enums; using Filtration.ObjectModel.Enums;
@ -91,11 +90,11 @@ namespace Filtration.Tests.Translators
var testBlock = new ItemFilterBlock(); var testBlock = new ItemFilterBlock();
testBlock.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.Equal, 5)); testBlock.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.Equal, 5));
const string BlockOutput = "Test Script Output"; const string blockOutput = "Test Script Output";
testScript.ItemFilterBlocks.Add(testBlock); testScript.ItemFilterBlocks.Add(testBlock);
_testUtility.MockItemFilterBlockTranslator.Setup(t => t.TranslateItemFilterBlockToString(testBlock)).Returns(BlockOutput).Verifiable(); _testUtility.MockItemFilterBlockTranslator.Setup(t => t.TranslateItemFilterBlockToString(testBlock)).Returns(blockOutput).Verifiable();
// Act // Act
@ -400,9 +399,9 @@ namespace Filtration.Tests.Translators
ScriptTranslator = new ItemFilterScriptTranslator(MockItemFilterBlockTranslator.Object, MockBlockGroupHierarchyBuilder.Object); ScriptTranslator = new ItemFilterScriptTranslator(MockItemFilterBlockTranslator.Object, MockBlockGroupHierarchyBuilder.Object);
} }
public ItemFilterScriptTranslator ScriptTranslator { get; private set; } public ItemFilterScriptTranslator ScriptTranslator { get; }
public Mock<IItemFilterBlockTranslator> MockItemFilterBlockTranslator { get; private set; } public Mock<IItemFilterBlockTranslator> MockItemFilterBlockTranslator { get; }
public Mock<IBlockGroupHierarchyBuilder> MockBlockGroupHierarchyBuilder { get; private set; } public Mock<IBlockGroupHierarchyBuilder> MockBlockGroupHierarchyBuilder { get; }
} }
} }
} }

View File

@ -1,5 +1,4 @@
using System.Windows.Media; using System.Windows.Media;
using Filtration.ObjectModel.BlockItemTypes;
using Filtration.ObjectModel.Enums; using Filtration.ObjectModel.Enums;
using Filtration.ObjectModel.ThemeEditor; using Filtration.ObjectModel.ThemeEditor;
using NUnit.Framework; using NUnit.Framework;
@ -16,12 +15,12 @@ namespace Filtration.ThemeEditor.Tests.Models
var theme = new Theme(); var theme = new Theme();
var testInputComponentTargetType = ThemeComponentType.TextColor; var testInputComponentTargetType = ThemeComponentType.TextColor;
const string TestInputComponentName = "test"; const string testInputComponentName = "test";
theme.AddComponent(testInputComponentTargetType, TestInputComponentName, new Color()); theme.AddComponent(testInputComponentTargetType, testInputComponentName, new Color());
// Act // Act
var result = theme.ComponentExists(testInputComponentTargetType, TestInputComponentName); var result = theme.ComponentExists(testInputComponentTargetType, testInputComponentName);
// Assert // Assert
Assert.AreEqual(true, result); Assert.AreEqual(true, result);
@ -34,8 +33,8 @@ namespace Filtration.ThemeEditor.Tests.Models
var theme = new Theme(); var theme = new Theme();
var testInputComponentTargetType = ThemeComponentType.TextColor; var testInputComponentTargetType = ThemeComponentType.TextColor;
const string TestInputComponentName = "test"; const string testInputComponentName = "test";
theme.AddComponent(testInputComponentTargetType, TestInputComponentName, new Color()); theme.AddComponent(testInputComponentTargetType, testInputComponentName, new Color());
// Act // Act
var result = theme.ComponentExists(testInputComponentTargetType, "blah"); var result = theme.ComponentExists(testInputComponentTargetType, "blah");
@ -51,12 +50,12 @@ namespace Filtration.ThemeEditor.Tests.Models
var theme = new Theme(); var theme = new Theme();
var testInputComponentTargetType = ThemeComponentType.TextColor; var testInputComponentTargetType = ThemeComponentType.TextColor;
const string TestInputComponentName = "test"; const string testInputComponentName = "test";
theme.AddComponent(testInputComponentTargetType, TestInputComponentName, new Color()); theme.AddComponent(testInputComponentTargetType, testInputComponentName, new Color());
// Act // Act
var result = theme.ComponentExists(ThemeComponentType.BorderColor, TestInputComponentName); var result = theme.ComponentExists(ThemeComponentType.BorderColor, testInputComponentName);
// Assert // Assert
Assert.AreEqual(false, result); Assert.AreEqual(false, result);

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following

View File

@ -1,5 +1,4 @@
using System.Collections.ObjectModel; using System.IO;
using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using AutoMapper; using AutoMapper;

View File

@ -39,7 +39,7 @@ namespace Filtration.ThemeEditor.ViewModels
public class ThemeEditorViewModel : PaneViewModel, IThemeEditorViewModel public class ThemeEditorViewModel : PaneViewModel, IThemeEditorViewModel
{ {
private static readonly Logger _logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly IThemeProvider _themeProvider; private readonly IThemeProvider _themeProvider;
private readonly IMessageBoxService _messageBoxService; private readonly IMessageBoxService _messageBoxService;
@ -66,14 +66,11 @@ namespace Filtration.ThemeEditor.ViewModels
} }
public RelayCommand<ThemeComponentType> AddThemeComponentCommand { get; private set; } public RelayCommand<ThemeComponentType> AddThemeComponentCommand { get; }
public RelayCommand<ThemeComponent> DeleteThemeComponentCommand { get; private set; } public RelayCommand<ThemeComponent> DeleteThemeComponentCommand { get; }
public RelayCommand CloseCommand { get; private set; } public RelayCommand CloseCommand { get; }
public bool IsMasterTheme public bool IsMasterTheme => Components.IsMasterCollection;
{
get { return Components.IsMasterCollection; }
}
public ItemFilterScript IsMasterThemeForScript { get; private set; } public ItemFilterScript IsMasterThemeForScript { get; private set; }
@ -91,8 +88,8 @@ namespace Filtration.ThemeEditor.ViewModels
} }
public bool IsScript { get { return false; } } public bool IsScript => false;
public bool IsTheme { get { return true; } } public bool IsTheme => true;
public bool IsDirty { get; private set; } public bool IsDirty { get; private set; }
public string FilePath public string FilePath
@ -105,10 +102,7 @@ namespace Filtration.ThemeEditor.ViewModels
} }
} }
public string Filename public string Filename => _filenameIsFake ? FilePath : Path.GetFileName(FilePath);
{
get { return _filenameIsFake ? FilePath : Path.GetFileName(FilePath); }
}
public string Name { get; set; } public string Name { get; set; }
@ -141,9 +135,9 @@ namespace Filtration.ThemeEditor.ViewModels
} }
catch (Exception e) catch (Exception e)
{ {
if (_logger.IsErrorEnabled) if (Logger.IsErrorEnabled)
{ {
_logger.Error(e); Logger.Error(e);
} }
_messageBoxService.Show("Save Error", "Error saving filter theme - " + e.Message, MessageBoxButton.OK, MessageBoxImage.Error); _messageBoxService.Show("Save Error", "Error saving filter theme - " + e.Message, MessageBoxButton.OK, MessageBoxImage.Error);
@ -175,9 +169,9 @@ namespace Filtration.ThemeEditor.ViewModels
} }
catch (Exception e) catch (Exception e)
{ {
if (_logger.IsErrorEnabled) if (Logger.IsErrorEnabled)
{ {
_logger.Error(e); Logger.Error(e);
} }
_messageBoxService.Show("Save Error", "Error saving theme file - " + e.Message, MessageBoxButton.OK, _messageBoxService.Show("Save Error", "Error saving theme file - " + e.Message, MessageBoxButton.OK,

View File

@ -20,7 +20,7 @@ namespace Filtration
public partial class App public partial class App
{ {
private IWindsorContainer _container; private IWindsorContainer _container;
private static readonly Logger _logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private void Application_Startup(object sender, StartupEventArgs e) private void Application_Startup(object sender, StartupEventArgs e)
{ {
@ -69,7 +69,7 @@ namespace Filtration
public void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) public void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{ {
_logger.Fatal(e.Exception); Logger.Fatal(e.Exception);
var exception = e.Exception.Message + Environment.NewLine + e.Exception.StackTrace; var exception = e.Exception.Message + Environment.NewLine + e.Exception.StackTrace;
var innerException = e.Exception.InnerException != null var innerException = e.Exception.InnerException != null
? e.Exception.InnerException.Message + Environment.NewLine + ? e.Exception.InnerException.Message + Environment.NewLine +

View File

@ -9,12 +9,12 @@ namespace Filtration.Converters
{ {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{ {
return (ItemRarity) ((int) value); return (ItemRarity) (int) value;
} }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{ {
return (int) ((ItemRarity) value); return (int) (ItemRarity) value;
} }
} }
} }

View File

@ -12,7 +12,7 @@ namespace Filtration.Extensions
public EnumerationExtension(Type enumType) public EnumerationExtension(Type enumType)
{ {
if (enumType == null) throw new ArgumentNullException("enumType"); if (enumType == null) throw new ArgumentNullException(nameof(enumType));
EnumType = enumType; EnumType = enumType;
} }

View File

@ -13,7 +13,7 @@ namespace Filtration.Services
internal class ClipboardService : IClipboardService internal class ClipboardService : IClipboardService
{ {
private static readonly Logger _logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public void SetClipboardText(string inputText) public void SetClipboardText(string inputText)
{ {
@ -26,7 +26,7 @@ namespace Filtration.Services
} }
catch (Exception e) catch (Exception e)
{ {
_logger.Error(e); Logger.Error(e);
} }
Thread.Sleep(10); Thread.Sleep(10);

View File

@ -12,7 +12,7 @@ namespace Filtration.Services
internal class UpdateCheckService : IUpdateCheckService internal class UpdateCheckService : IUpdateCheckService
{ {
private readonly IHTTPService _httpService; private readonly IHTTPService _httpService;
private const string UpdateDataUrl = "http://ben-wallis.github.io/Filtration/filtration_version.xml"; private const string _updateDataUrl = "http://ben-wallis.github.io/Filtration/filtration_version.xml";
public UpdateCheckService(IHTTPService httpService) public UpdateCheckService(IHTTPService httpService)
{ {
@ -21,8 +21,8 @@ namespace Filtration.Services
public UpdateData GetUpdateData() public UpdateData GetUpdateData()
{ {
var updateXml = _httpService.GetContent(UpdateDataUrl); var updateXml = _httpService.GetContent(_updateDataUrl);
return (DeserializeUpdateData(updateXml)); return DeserializeUpdateData(updateXml);
} }
public UpdateData DeserializeUpdateData(string updateDataString) public UpdateData DeserializeUpdateData(string updateDataString)

View File

@ -26,9 +26,9 @@ namespace Filtration.Translators
internal class ItemFilterBlockTranslator : IItemFilterBlockTranslator internal class ItemFilterBlockTranslator : IItemFilterBlockTranslator
{ {
private readonly IBlockGroupHierarchyBuilder _blockGroupHierarchyBuilder; private readonly IBlockGroupHierarchyBuilder _blockGroupHierarchyBuilder;
private const string Indent = " "; private const string _indent = " ";
private readonly string _newLine = Environment.NewLine + Indent; private readonly string _newLine = Environment.NewLine + _indent;
private readonly string _disabledNewLine = Environment.NewLine + "#" + Indent; private readonly string _disabledNewLine = Environment.NewLine + "#" + _indent;
private ThemeComponentCollection _masterComponentCollection; private ThemeComponentCollection _masterComponentCollection;
public ItemFilterBlockTranslator(IBlockGroupHierarchyBuilder blockGroupHierarchyBuilder) public ItemFilterBlockTranslator(IBlockGroupHierarchyBuilder blockGroupHierarchyBuilder)
@ -118,7 +118,7 @@ namespace Filtration.Translators
blockItemValue.FilterPredicate.PredicateOperator = blockItemValue.FilterPredicate.PredicateOperator =
EnumHelper.GetEnumValueFromDescription<FilterPredicateOperator>(string.IsNullOrEmpty(result.Groups[1].Value) ? "=" : result.Groups[1].Value); EnumHelper.GetEnumValueFromDescription<FilterPredicateOperator>(string.IsNullOrEmpty(result.Groups[1].Value) ? "=" : result.Groups[1].Value);
blockItemValue.FilterPredicate.PredicateOperand = blockItemValue.FilterPredicate.PredicateOperand =
(int)(EnumHelper.GetEnumValueFromDescription<ItemRarity>(result.Groups[2].Value)); (int)EnumHelper.GetEnumValueFromDescription<ItemRarity>(result.Groups[2].Value);
} }
block.BlockItems.Add(blockItemValue); block.BlockItems.Add(blockItemValue);
break; break;

View File

@ -122,7 +122,7 @@ namespace Filtration.Translators
for (var boundary = conditionBoundaries.First; boundary != null; boundary = boundary.Next) for (var boundary = conditionBoundaries.First; boundary != null; boundary = boundary.Next)
{ {
var begin = boundary.Value; var begin = boundary.Value;
var end = boundary.Next != null ? boundary.Next.Value : lines.Length; var end = boundary.Next?.Value ?? lines.Length;
var block = new string[end - begin]; var block = new string[end - begin];
Array.Copy(lines, begin, block, 0, end - begin); Array.Copy(lines, begin, block, 0, end - begin);
var blockString = string.Join("\r\n", block); var blockString = string.Join("\r\n", block);

View File

@ -80,28 +80,14 @@ namespace Filtration.UserControls
} }
public ObservableCollection<ColorItem> AvailableColors public ObservableCollection<ColorItem> AvailableColors => PathOfExileColors.DefaultColors;
{
get
{
{
return PathOfExileColors.DefaultColors;
}
}
}
public List<int> SoundsAvailable public List<int> SoundsAvailable => new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
{
get
{
return new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
}
}
private void OnSetBlockColorCommmand() private void OnSetBlockColorCommmand()
{ {
var blockItem = BlockItem as ColorBlockItem; var blockItem = BlockItem as ColorBlockItem;
if (blockItem == null || blockItem.ThemeComponent == null) return; if (blockItem?.ThemeComponent == null) return;
blockItem.Color = blockItem.ThemeComponent.Color; blockItem.Color = blockItem.ThemeComponent.Color;
} }
@ -112,7 +98,7 @@ namespace Filtration.UserControls
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{ {
var handler = PropertyChanged; var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
} }
} }

View File

@ -94,9 +94,8 @@ namespace Filtration.UserControls
DependencyPropertyChangedEventArgs e) DependencyPropertyChangedEventArgs e)
{ {
var control = source as EditableListBoxControl; var control = source as EditableListBoxControl;
if (control == null) return;
control.OnPropertyChanged("ItemsSource"); control?.OnPropertyChanged(nameof(ItemsSource));
} }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
@ -105,7 +104,7 @@ namespace Filtration.UserControls
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{ {
var handler = PropertyChanged; var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
} }
} }

View File

@ -50,8 +50,8 @@ namespace Filtration.UserControls
{ {
SetValue(NumericFilterPredicateProperty, value); SetValue(NumericFilterPredicateProperty, value);
OnPropertyChanged(); OnPropertyChanged();
OnPropertyChanged("FilterPredicateOperator"); OnPropertyChanged(nameof(FilterPredicateOperator));
OnPropertyChanged("FilterPredicateOperand"); OnPropertyChanged(nameof(FilterPredicateOperand));
} }
} }
@ -117,8 +117,8 @@ namespace Filtration.UserControls
var control = source as NumericFilterPredicateControl; var control = source as NumericFilterPredicateControl;
if (control == null) return; if (control == null) return;
control.OnPropertyChanged("FilterPredicateOperator"); control.OnPropertyChanged(nameof(FilterPredicateOperator));
control.OnPropertyChanged("FilterPredicateOperand"); control.OnPropertyChanged(nameof(FilterPredicateOperand));
} }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
@ -127,7 +127,7 @@ namespace Filtration.UserControls
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{ {
var handler = PropertyChanged; var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
} }
} }

View File

@ -67,14 +67,11 @@ namespace Filtration.UserControls
{ {
_showThemeComponentComboBox = value; _showThemeComponentComboBox = value;
OnPropertyChanged(); OnPropertyChanged();
OnPropertyChanged("HasThemeComponent"); OnPropertyChanged(nameof(HasThemeComponent));
} }
} }
public bool HasThemeComponent public bool HasThemeComponent => ThemeComponent != null;
{
get { return ThemeComponent != null; }
}
private void OnAddThemeComponentCommand() private void OnAddThemeComponentCommand()
{ {
@ -93,7 +90,7 @@ namespace Filtration.UserControls
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{ {
var handler = PropertyChanged; var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
} }
} }

View File

@ -36,7 +36,6 @@ namespace Filtration.ViewModels
private IItemFilterScriptViewModel _activeScriptViewModel; private IItemFilterScriptViewModel _activeScriptViewModel;
private IThemeEditorViewModel _activeThemeViewModel; private IThemeEditorViewModel _activeThemeViewModel;
private readonly ObservableCollection<IDocument> _openDocuments; private readonly ObservableCollection<IDocument> _openDocuments;
private readonly ReadOnlyObservableCollection<IDocument> _readOnlyOpenDocuments;
public AvalonDockWorkspaceViewModel(ISectionBrowserViewModel sectionBrowserViewModel, public AvalonDockWorkspaceViewModel(ISectionBrowserViewModel sectionBrowserViewModel,
IBlockGroupBrowserViewModel blockGroupBrowserViewModel, IBlockGroupBrowserViewModel blockGroupBrowserViewModel,
@ -52,16 +51,13 @@ namespace Filtration.ViewModels
_blockOutputPreviewViewModel.Initialise(this); _blockOutputPreviewViewModel.Initialise(this);
_openDocuments = new ObservableCollection<IDocument> {startPageViewModel}; _openDocuments = new ObservableCollection<IDocument> {startPageViewModel};
_readOnlyOpenDocuments = new ReadOnlyObservableCollection<IDocument>(_openDocuments); OpenDocuments = new ReadOnlyObservableCollection<IDocument>(_openDocuments);
ActiveDocument = startPageViewModel; ActiveDocument = startPageViewModel;
} }
public event EventHandler ActiveDocumentChanged; public event EventHandler ActiveDocumentChanged;
public ReadOnlyObservableCollection<IDocument> OpenDocuments public ReadOnlyObservableCollection<IDocument> OpenDocuments { get; }
{
get { return _readOnlyOpenDocuments; }
}
public IDocument ActiveDocument public IDocument ActiveDocument
{ {
@ -87,54 +83,26 @@ namespace Filtration.ViewModels
_activeThemeViewModel = null; _activeThemeViewModel = null;
} }
if (ActiveDocumentChanged != null) ActiveDocumentChanged?.Invoke(this, EventArgs.Empty);
{
ActiveDocumentChanged(this, EventArgs.Empty);
}
Messenger.Default.Send(new NotificationMessage("ActiveDocumentChanged")); Messenger.Default.Send(new NotificationMessage("ActiveDocumentChanged"));
} }
} }
public IItemFilterScriptViewModel ActiveScriptViewModel public IItemFilterScriptViewModel ActiveScriptViewModel => _activeScriptViewModel;
{ public IThemeEditorViewModel ActiveThemeViewModel => _activeThemeViewModel;
get { return _activeScriptViewModel; } public IBlockGroupBrowserViewModel BlockGroupBrowserViewModel => _blockGroupBrowserViewModel;
} public IBlockOutputPreviewViewModel BlockOutputPreviewViewModel => _blockOutputPreviewViewModel;
public ISectionBrowserViewModel SectionBrowserViewModel => _sectionBrowserViewModel;
public IThemeEditorViewModel ActiveThemeViewModel
{
get { return _activeThemeViewModel; }
}
public IBlockGroupBrowserViewModel BlockGroupBrowserViewModel
{
get { return _blockGroupBrowserViewModel; }
}
public IBlockOutputPreviewViewModel BlockOutputPreviewViewModel
{
get { return _blockOutputPreviewViewModel; }
}
public ISectionBrowserViewModel SectionBrowserViewModel
{
get { return _sectionBrowserViewModel; }
}
private List<IToolViewModel> _tools; private List<IToolViewModel> _tools;
public IEnumerable<IToolViewModel> Tools public IEnumerable<IToolViewModel> Tools => _tools ?? (_tools = new List<IToolViewModel>
{
get
{
return _tools ?? (_tools = new List<IToolViewModel>
{ {
_sectionBrowserViewModel, _sectionBrowserViewModel,
_blockGroupBrowserViewModel, _blockGroupBrowserViewModel,
_blockOutputPreviewViewModel _blockOutputPreviewViewModel
}); });
}
}
public void AddDocument(IDocument document) public void AddDocument(IDocument document)
{ {

View File

@ -65,7 +65,7 @@ namespace Filtration.ViewModels
{ {
if (itemFilterBlock == null || parentScriptViewModel == null) if (itemFilterBlock == null || parentScriptViewModel == null)
{ {
throw new ArgumentNullException("itemFilterBlock"); throw new ArgumentNullException(nameof(itemFilterBlock));
} }
_parentScriptViewModel = parentScriptViewModel; _parentScriptViewModel = parentScriptViewModel;
@ -112,10 +112,7 @@ namespace Filtration.ViewModels
} }
} }
public ObservableCollection<IItemFilterBlockItem> BlockItems public ObservableCollection<IItemFilterBlockItem> BlockItems => Block.BlockItems;
{
get { return Block.BlockItems; }
}
public IEnumerable<IItemFilterBlockItem> SummaryBlockItems public IEnumerable<IItemFilterBlockItem> SummaryBlockItems
{ {
@ -132,13 +129,7 @@ namespace Filtration.ViewModels
get { return Block.BlockItems.Where(b => b is IAudioVisualBlockItem); } get { return Block.BlockItems.Where(b => b is IAudioVisualBlockItem); }
} }
public bool AdvancedBlockGroup public bool AdvancedBlockGroup => Block.BlockGroup != null && Block.BlockGroup.Advanced;
{
get
{
return Block.BlockGroup != null && Block.BlockGroup.Advanced;
}
}
public bool AudioVisualBlockItemsGridVisible public bool AudioVisualBlockItemsGridVisible
{ {
@ -164,21 +155,11 @@ namespace Filtration.ViewModels
} }
} }
public IEnumerable<string> AutoCompleteItemClasses public IEnumerable<string> AutoCompleteItemClasses => _staticDataService.ItemClasses;
{
get { return _staticDataService.ItemClasses; }
}
public IEnumerable<string> AutoCompleteItemBaseTypes public IEnumerable<string> AutoCompleteItemBaseTypes => _staticDataService.ItemBaseTypes;
{
get { return _staticDataService.ItemBaseTypes; }
}
public List<Type> BlockItemTypesAvailable public List<Type> BlockItemTypesAvailable => new List<Type>
{
get
{
return new List<Type>
{ {
typeof (ItemLevelBlockItem), typeof (ItemLevelBlockItem),
typeof (DropLevelBlockItem), typeof (DropLevelBlockItem),
@ -192,14 +173,8 @@ namespace Filtration.ViewModels
typeof (ClassBlockItem), typeof (ClassBlockItem),
typeof (BaseTypeBlockItem) typeof (BaseTypeBlockItem)
}; };
}
}
public List<Type> AudioVisualBlockItemTypesAvailable public List<Type> AudioVisualBlockItemTypesAvailable => new List<Type>
{
get
{
return new List<Type>
{ {
typeof (TextColorBlockItem), typeof (TextColorBlockItem),
typeof (BackgroundColorBlockItem), typeof (BackgroundColorBlockItem),
@ -207,8 +182,6 @@ namespace Filtration.ViewModels
typeof (FontSizeBlockItem), typeof (FontSizeBlockItem),
typeof (SoundBlockItem) typeof (SoundBlockItem)
}; };
}
}
public bool BlockEnabled public bool BlockEnabled
{ {
@ -241,87 +214,43 @@ namespace Filtration.ViewModels
} }
} }
public ObservableCollection<ColorItem> AvailableColors public ObservableCollection<ColorItem> AvailableColors => PathOfExileColors.DefaultColors;
{
get
{
{
return PathOfExileColors.DefaultColors;
}
}
}
public bool HasTextColor public bool HasTextColor => Block.HasBlockItemOfType<TextColorBlockItem>();
{
get { return Block.HasBlockItemOfType<TextColorBlockItem>(); }
}
public Color DisplayTextColor public Color DisplayTextColor => HasTextColor
{
get
{
return HasTextColor
? BlockItems.OfType<TextColorBlockItem>().First().Color ? BlockItems.OfType<TextColorBlockItem>().First().Color
: new Color { A = 255, R = 200, G = 200, B = 200 }; : new Color {A = 255, R = 200, G = 200, B = 200};
}
}
public bool HasBackgroundColor public bool HasBackgroundColor => Block.HasBlockItemOfType<BackgroundColorBlockItem>();
{
get { return Block.HasBlockItemOfType<BackgroundColorBlockItem>(); }
}
public Color DisplayBackgroundColor public Color DisplayBackgroundColor => HasBackgroundColor
{
get
{
return HasBackgroundColor
? BlockItems.OfType<BackgroundColorBlockItem>().First().Color ? BlockItems.OfType<BackgroundColorBlockItem>().First().Color
: new Color { A = 255, R = 0, G = 0, B = 0 }; : new Color { A = 255, R = 0, G = 0, B = 0 };
}
}
public bool HasBorderColor public bool HasBorderColor => Block.HasBlockItemOfType<BorderColorBlockItem>();
{
get { return Block.HasBlockItemOfType<BorderColorBlockItem>(); }
}
public Color DisplayBorderColor public Color DisplayBorderColor => HasBorderColor
{
get
{
return HasBorderColor
? BlockItems.OfType<BorderColorBlockItem>().First().Color ? BlockItems.OfType<BorderColorBlockItem>().First().Color
: new Color { A = 255, R = 0, G = 0, B = 0 }; : new Color { A = 255, R = 0, G = 0, B = 0 };
}
}
public bool HasFontSize public bool HasFontSize => Block.HasBlockItemOfType<FontSizeBlockItem>();
{
get { return Block.HasBlockItemOfType<FontSizeBlockItem>(); }
}
public double DisplayFontSize public double DisplayFontSize
{ {
// Dividing by 1.8 roughly scales in-game font sizes down to WPF sizes // Dividing by 1.8 roughly scales in-game font sizes down to WPF sizes
get get
{ {
var fontSize = HasFontSize ? (BlockItems.OfType<FontSizeBlockItem>().First().Value / 1.8) : 19; var fontSize = HasFontSize ? BlockItems.OfType<FontSizeBlockItem>().First().Value / 1.8 : 19;
return fontSize; return fontSize;
} }
} }
public bool HasSound public bool HasSound => Block.HasBlockItemOfType<SoundBlockItem>();
{
get { return Block.HasBlockItemOfType<SoundBlockItem>(); }
}
public bool HasAudioVisualBlockItems public bool HasAudioVisualBlockItems => AudioVisualBlockItems.Any();
{
get { return AudioVisualBlockItems.Any(); }
}
private void OnSwitchBlockItemsViewCommand() private void OnSwitchBlockItemsViewCommand()
{ {
@ -331,10 +260,7 @@ namespace Filtration.ViewModels
private void OnToggleBlockActionCommand() private void OnToggleBlockActionCommand()
{ {
var actionBlock = Block.BlockItems.OfType<ActionBlockItem>().First(); var actionBlock = Block.BlockItems.OfType<ActionBlockItem>().First();
if (actionBlock != null) actionBlock?.ToggleAction();
{
actionBlock.ToggleAction();
}
} }
private void OnAddFilterBlockItemCommand(Type blockItemType) private void OnAddFilterBlockItemCommand(Type blockItemType)

View File

@ -68,7 +68,7 @@ namespace Filtration.ViewModels
internal class ItemFilterScriptViewModel : PaneViewModel, IItemFilterScriptViewModel internal class ItemFilterScriptViewModel : PaneViewModel, IItemFilterScriptViewModel
{ {
private static readonly Logger _logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly IItemFilterBlockViewModelFactory _itemFilterBlockViewModelFactory; private readonly IItemFilterBlockViewModelFactory _itemFilterBlockViewModelFactory;
private readonly IItemFilterBlockTranslator _blockTranslator; private readonly IItemFilterBlockTranslator _blockTranslator;
@ -129,24 +129,24 @@ namespace Filtration.ViewModels
IconSource = icon; IconSource = icon;
} }
public RelayCommand<bool> ToggleShowAdvancedCommand { get; private set; } public RelayCommand<bool> ToggleShowAdvancedCommand { get; }
public RelayCommand ClearFilterCommand { get; private set; } public RelayCommand ClearFilterCommand { get; }
public RelayCommand CloseCommand { get; private set; } public RelayCommand CloseCommand { get; }
public RelayCommand DeleteBlockCommand { get; private set; } public RelayCommand DeleteBlockCommand { get; }
public RelayCommand MoveBlockToTopCommand { get; private set; } public RelayCommand MoveBlockToTopCommand { get; }
public RelayCommand MoveBlockUpCommand { get; private set; } public RelayCommand MoveBlockUpCommand { get; }
public RelayCommand MoveBlockDownCommand { get; private set; } public RelayCommand MoveBlockDownCommand { get; }
public RelayCommand MoveBlockToBottomCommand { get; private set; } public RelayCommand MoveBlockToBottomCommand { get; }
public RelayCommand AddBlockCommand { get; private set; } public RelayCommand AddBlockCommand { get; }
public RelayCommand AddSectionCommand { get; private set; } public RelayCommand AddSectionCommand { get; }
public RelayCommand EnableBlockCommand { get; private set; } public RelayCommand EnableBlockCommand { get; }
public RelayCommand DisableBlockCommand { get; private set; } public RelayCommand DisableBlockCommand { get; }
public RelayCommand CopyBlockCommand { get; private set; } public RelayCommand CopyBlockCommand { get; }
public RelayCommand CopyBlockStyleCommand { get; private set; } public RelayCommand CopyBlockStyleCommand { get; }
public RelayCommand PasteBlockCommand { get; private set; } public RelayCommand PasteBlockCommand { get; }
public RelayCommand PasteBlockStyleCommand { get; private set; } public RelayCommand PasteBlockStyleCommand { get; }
public RelayCommand ExpandAllBlocksCommand { get; private set; } public RelayCommand ExpandAllBlocksCommand { get; }
public RelayCommand CollapseAllBlocksCommand { get; private set; } public RelayCommand CollapseAllBlocksCommand { get; }
public ObservableCollection<IItemFilterBlockViewModel> ItemFilterBlockViewModels public ObservableCollection<IItemFilterBlockViewModel> ItemFilterBlockViewModels
{ {
@ -203,8 +203,8 @@ namespace Filtration.ViewModels
get { return ItemFilterBlockViewModels.Where(b => b.Block.GetType() == typeof (ItemFilterSection)); } get { return ItemFilterBlockViewModels.Where(b => b.Block.GetType() == typeof (ItemFilterSection)); }
} }
public bool IsScript { get { return true; } } public bool IsScript => true;
public bool IsTheme { get { return false; } } public bool IsTheme => false;
public string Description public string Description
{ {
@ -306,20 +306,11 @@ namespace Filtration.ViewModels
RaisePropertyChanged("DisplayName"); RaisePropertyChanged("DisplayName");
} }
public string DisplayName public string DisplayName => !string.IsNullOrEmpty(Filename) ? Filename : Description;
{
get { return !string.IsNullOrEmpty(Filename) ? Filename : Description; }
}
public string Filename public string Filename => Path.GetFileName(Script.FilePath);
{
get { return Path.GetFileName(Script.FilePath); }
}
public string Filepath public string Filepath => Script.FilePath;
{
get { return Script.FilePath; }
}
private bool _filenameIsFake; private bool _filenameIsFake;
private bool _showAdvanced; private bool _showAdvanced;
@ -371,9 +362,9 @@ namespace Filtration.ViewModels
} }
catch (Exception e) catch (Exception e)
{ {
if (_logger.IsErrorEnabled) if (Logger.IsErrorEnabled)
{ {
_logger.Error(e); Logger.Error(e);
} }
_messageBoxService.Show("Save Error", "Error saving filter file - " + e.Message, MessageBoxButton.OK, _messageBoxService.Show("Save Error", "Error saving filter file - " + e.Message, MessageBoxButton.OK,
@ -383,8 +374,6 @@ namespace Filtration.ViewModels
{ {
Messenger.Default.Send(new NotificationMessage("HideLoadingBanner")); Messenger.Default.Send(new NotificationMessage("HideLoadingBanner"));
} }
return;
} }
public async Task SaveAsAsync() public async Task SaveAsAsync()
@ -416,9 +405,9 @@ namespace Filtration.ViewModels
} }
catch (Exception e) catch (Exception e)
{ {
if (_logger.IsErrorEnabled) if (Logger.IsErrorEnabled)
{ {
_logger.Error(e); Logger.Error(e);
} }
_messageBoxService.Show("Save Error", "Error saving filter file - " + e.Message, MessageBoxButton.OK, _messageBoxService.Show("Save Error", "Error saving filter file - " + e.Message, MessageBoxButton.OK,
@ -442,7 +431,7 @@ namespace Filtration.ViewModels
if (unusedThemeComponents.Count <= 0) return true; if (unusedThemeComponents.Count <= 0) return true;
var themeComponents = unusedThemeComponents.Aggregate(string.Empty, var themeComponents = unusedThemeComponents.Aggregate(string.Empty,
(current, themeComponent) => current + (themeComponent.ComponentName + Environment.NewLine)); (current, themeComponent) => current + themeComponent.ComponentName + Environment.NewLine);
var ignoreUnusedThemeComponents = _messageBoxService.Show("Unused Theme Components", var ignoreUnusedThemeComponents = _messageBoxService.Show("Unused Theme Components",
"The following theme components are unused, they will be lost when this script is reopened. Save anyway?" + "The following theme components are unused, they will be lost when this script is reopened. Save anyway?" +
@ -655,10 +644,8 @@ namespace Filtration.ViewModels
} }
catch (Exception e) catch (Exception e)
{ {
_logger.Error(e); Logger.Error(e);
var innerException = e.InnerException != null var innerException = e.InnerException?.Message ?? string.Empty;
? e.InnerException.Message
: string.Empty;
_messageBoxService.Show("Paste Error", _messageBoxService.Show("Paste Error",
e.Message + Environment.NewLine + innerException, MessageBoxButton.OK, e.Message + Environment.NewLine + innerException, MessageBoxButton.OK,

View File

@ -4,14 +4,11 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Threading;
using Filtration.Common.Services; using Filtration.Common.Services;
using Filtration.Common.ViewModels; using Filtration.Common.ViewModels;
using Filtration.Interface; using Filtration.Interface;
@ -44,13 +41,12 @@ namespace Filtration.ViewModels
internal class MainWindowViewModel : FiltrationViewModelBase, IMainWindowViewModel internal class MainWindowViewModel : FiltrationViewModelBase, IMainWindowViewModel
{ {
private static readonly Logger _logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly IItemFilterScriptRepository _itemFilterScriptRepository; private readonly IItemFilterScriptRepository _itemFilterScriptRepository;
private readonly IItemFilterScriptTranslator _itemFilterScriptTranslator; private readonly IItemFilterScriptTranslator _itemFilterScriptTranslator;
private readonly IReplaceColorsViewModel _replaceColorsViewModel; private readonly IReplaceColorsViewModel _replaceColorsViewModel;
private readonly IAvalonDockWorkspaceViewModel _avalonDockWorkspaceViewModel; private readonly IAvalonDockWorkspaceViewModel _avalonDockWorkspaceViewModel;
private readonly ISettingsPageViewModel _settingsPageViewModel;
private readonly IThemeProvider _themeProvider; private readonly IThemeProvider _themeProvider;
private readonly IThemeService _themeService; private readonly IThemeService _themeService;
private readonly IUpdateCheckService _updateCheckService; private readonly IUpdateCheckService _updateCheckService;
@ -75,7 +71,7 @@ namespace Filtration.ViewModels
_itemFilterScriptTranslator = itemFilterScriptTranslator; _itemFilterScriptTranslator = itemFilterScriptTranslator;
_replaceColorsViewModel = replaceColorsViewModel; _replaceColorsViewModel = replaceColorsViewModel;
_avalonDockWorkspaceViewModel = avalonDockWorkspaceViewModel; _avalonDockWorkspaceViewModel = avalonDockWorkspaceViewModel;
_settingsPageViewModel = settingsPageViewModel; SettingsPageViewModel = settingsPageViewModel;
_themeProvider = themeProvider; _themeProvider = themeProvider;
_themeService = themeService; _themeService = themeService;
_updateCheckService = updateCheckService; _updateCheckService = updateCheckService;
@ -196,45 +192,45 @@ namespace Filtration.ViewModels
CheckForUpdates(); CheckForUpdates();
} }
public RelayCommand OpenScriptCommand { get; private set; } public RelayCommand OpenScriptCommand { get; }
public RelayCommand OpenThemeCommand { get; private set; } public RelayCommand OpenThemeCommand { get; }
public RelayCommand SaveCommand { get; private set; } public RelayCommand SaveCommand { get; }
public RelayCommand SaveAsCommand { get; private set; } public RelayCommand SaveAsCommand { get; }
public RelayCommand CopyBlockCommand { get; private set; } public RelayCommand CopyBlockCommand { get; }
public RelayCommand CopyBlockStyleCommand { get; private set; } public RelayCommand CopyBlockStyleCommand { get; }
public RelayCommand PasteCommand { get; private set; } public RelayCommand PasteCommand { get; }
public RelayCommand PasteBlockStyleCommand { get; private set; } public RelayCommand PasteBlockStyleCommand { get; }
public RelayCommand CopyScriptCommand { get; private set; } public RelayCommand CopyScriptCommand { get; }
public RelayCommand NewScriptCommand { get; private set; } public RelayCommand NewScriptCommand { get; }
public RelayCommand CloseCommand { get; private set; } public RelayCommand CloseCommand { get; }
public RelayCommand OpenAboutWindowCommand { get; private set; } public RelayCommand OpenAboutWindowCommand { get; }
public RelayCommand ReplaceColorsCommand { get; private set; } public RelayCommand ReplaceColorsCommand { get; }
public RelayCommand EditMasterThemeCommand { get; private set; } public RelayCommand EditMasterThemeCommand { get; }
public RelayCommand CreateThemeCommand { get; private set; } public RelayCommand CreateThemeCommand { get; }
public RelayCommand ApplyThemeToScriptCommand { get; private set; } public RelayCommand ApplyThemeToScriptCommand { get; }
public RelayCommand AddTextColorThemeComponentCommand { get; private set; } public RelayCommand AddTextColorThemeComponentCommand { get; }
public RelayCommand AddBackgroundColorThemeComponentCommand { get; private set; } public RelayCommand AddBackgroundColorThemeComponentCommand { get; }
public RelayCommand AddBorderColorThemeComponentCommand { get; private set; } public RelayCommand AddBorderColorThemeComponentCommand { get; }
public RelayCommand DeleteThemeComponentCommand { get; private set; } public RelayCommand DeleteThemeComponentCommand { get; }
public RelayCommand AddBlockCommand { get; private set; } public RelayCommand AddBlockCommand { get; }
public RelayCommand AddSectionCommand { get; private set; } public RelayCommand AddSectionCommand { get; }
public RelayCommand DeleteBlockCommand { get; private set; } public RelayCommand DeleteBlockCommand { get; }
public RelayCommand DisableBlockCommand { get; private set; } public RelayCommand DisableBlockCommand { get; }
public RelayCommand EnableBlockCommand { get; private set; } public RelayCommand EnableBlockCommand { get; }
public RelayCommand MoveBlockUpCommand { get; private set; } public RelayCommand MoveBlockUpCommand { get; }
public RelayCommand MoveBlockDownCommand { get; private set; } public RelayCommand MoveBlockDownCommand { get; }
public RelayCommand MoveBlockToTopCommand { get; private set; } public RelayCommand MoveBlockToTopCommand { get; }
public RelayCommand MoveBlockToBottomCommand { get; private set; } public RelayCommand MoveBlockToBottomCommand { get; }
public RelayCommand ExpandAllBlocksCommand { get; private set; } public RelayCommand ExpandAllBlocksCommand { get; }
public RelayCommand CollapseAllBlocksCommand { get; private set; } public RelayCommand CollapseAllBlocksCommand { get; }
public RelayCommand<bool> ToggleShowAdvancedCommand { get; private set; } public RelayCommand<bool> ToggleShowAdvancedCommand { get; }
public RelayCommand ClearFiltersCommand { get; private set; } public RelayCommand ClearFiltersCommand { get; }
public void CheckForUpdates() public void CheckForUpdates()
@ -263,9 +259,9 @@ namespace Filtration.ViewModels
} }
catch (Exception e) catch (Exception e)
{ {
if (_logger.IsDebugEnabled) if (Logger.IsDebugEnabled)
{ {
_logger.Debug(e); Logger.Debug(e);
} }
// We don't care if the update check fails, because it could fail for multiple reasons // We don't care if the update check fails, because it could fail for multiple reasons
// including the user blocking Filtration in their firewall. // including the user blocking Filtration in their firewall.
@ -281,15 +277,9 @@ namespace Filtration.ViewModels
public ImageSource Icon { get; private set; } public ImageSource Icon { get; private set; }
public IAvalonDockWorkspaceViewModel AvalonDockWorkspaceViewModel public IAvalonDockWorkspaceViewModel AvalonDockWorkspaceViewModel => _avalonDockWorkspaceViewModel;
{
get { return _avalonDockWorkspaceViewModel; }
}
public ISettingsPageViewModel SettingsPageViewModel public ISettingsPageViewModel SettingsPageViewModel { get; }
{
get { return _settingsPageViewModel; }
}
public string WindowTitle public string WindowTitle
{ {
@ -311,48 +301,24 @@ namespace Filtration.ViewModels
} }
} }
public bool ActiveDocumentIsScript public bool ActiveDocumentIsScript => _avalonDockWorkspaceViewModel.ActiveDocument != null && _avalonDockWorkspaceViewModel.ActiveDocument.IsScript;
{
get { return _avalonDockWorkspaceViewModel.ActiveDocument != null && _avalonDockWorkspaceViewModel.ActiveDocument.IsScript; }
}
public bool ActiveDocumentIsTheme public bool ActiveDocumentIsTheme => _avalonDockWorkspaceViewModel.ActiveDocument!= null && _avalonDockWorkspaceViewModel.ActiveDocument.IsTheme;
{
get { return _avalonDockWorkspaceViewModel.ActiveDocument!= null && _avalonDockWorkspaceViewModel.ActiveDocument.IsTheme; }
}
public bool ActiveScriptHasSelectedBlock public bool ActiveScriptHasSelectedBlock => AvalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel != null;
{
get { return AvalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel != null; }
}
public bool ActiveScriptHasSelectedEnabledBlock public bool ActiveScriptHasSelectedEnabledBlock => AvalonDockWorkspaceViewModel.ActiveScriptViewModel.HasSelectedEnabledBlock();
{
get { return AvalonDockWorkspaceViewModel.ActiveScriptViewModel.HasSelectedEnabledBlock(); }
}
public bool ActiveScriptHasSelectedDisabledBlock public bool ActiveScriptHasSelectedDisabledBlock => AvalonDockWorkspaceViewModel.ActiveScriptViewModel.HasSelectedDisabledBlock();
{
get { return AvalonDockWorkspaceViewModel.ActiveScriptViewModel.HasSelectedDisabledBlock(); }
}
public bool ActiveThemeIsEditable public bool ActiveThemeIsEditable => AvalonDockWorkspaceViewModel.ActiveThemeViewModel.IsMasterTheme;
{
get { return AvalonDockWorkspaceViewModel.ActiveThemeViewModel.IsMasterTheme; }
}
private bool ActiveDocumentIsEditable() private bool ActiveDocumentIsEditable()
{ {
return AvalonDockWorkspaceViewModel.ActiveDocument is IEditableDocument; return AvalonDockWorkspaceViewModel.ActiveDocument is IEditableDocument;
} }
public bool ShowAdvancedStatus public bool ShowAdvancedStatus => ActiveDocumentIsScript && _avalonDockWorkspaceViewModel.ActiveScriptViewModel.ShowAdvanced;
{
get
{
return ActiveDocumentIsScript && _avalonDockWorkspaceViewModel.ActiveScriptViewModel.ShowAdvanced;
}
}
public async Task OpenDroppedFilesAsync(List<string> filenames) public async Task OpenDroppedFilesAsync(List<string> filenames)
{ {
@ -442,9 +408,9 @@ namespace Filtration.ViewModels
catch (IOException e) catch (IOException e)
{ {
Messenger.Default.Send(new NotificationMessage("HideLoadingBanner")); Messenger.Default.Send(new NotificationMessage("HideLoadingBanner"));
if (_logger.IsErrorEnabled) if (Logger.IsErrorEnabled)
{ {
_logger.Error(e); Logger.Error(e);
} }
_messageBoxService.Show("Script Load Error", "Error loading filter script - " + e.Message, _messageBoxService.Show("Script Load Error", "Error loading filter script - " + e.Message,
MessageBoxButton.OK, MessageBoxButton.OK,
@ -477,9 +443,9 @@ namespace Filtration.ViewModels
} }
catch (IOException e) catch (IOException e)
{ {
if (_logger.IsErrorEnabled) if (Logger.IsErrorEnabled)
{ {
_logger.Error(e); Logger.Error(e);
} }
_messageBoxService.Show("Theme Load Error", "Error loading filter theme - " + e.Message, _messageBoxService.Show("Theme Load Error", "Error loading filter theme - " + e.Message,
MessageBoxButton.OK, MessageBoxButton.OK,
@ -506,9 +472,9 @@ namespace Filtration.ViewModels
} }
catch (IOException e) catch (IOException e)
{ {
if (_logger.IsErrorEnabled) if (Logger.IsErrorEnabled)
{ {
_logger.Error(e); Logger.Error(e);
} }
_messageBoxService.Show("Theme Load Error", "Error loading filter theme - " + e.Message, _messageBoxService.Show("Theme Load Error", "Error loading filter theme - " + e.Message,
MessageBoxButton.OK, MessageBoxButton.OK,

View File

@ -62,15 +62,7 @@ namespace Filtration.ViewModels
_itemFilterScript = itemFilterScript; _itemFilterScript = itemFilterScript;
} }
public ObservableCollection<ColorItem> AvailableColors public ObservableCollection<ColorItem> AvailableColors => PathOfExileColors.DefaultColors;
{
get
{
{
return PathOfExileColors.DefaultColors;
}
}
}
public Color NewTextColor public Color NewTextColor
{ {
@ -83,15 +75,9 @@ namespace Filtration.ViewModels
} }
} }
public Color DisplayTextColor public Color DisplayTextColor => _replaceColorsParameterSet.ReplaceTextColor
{
get
{
return _replaceColorsParameterSet.ReplaceTextColor
? _replaceColorsParameterSet.NewTextColor ? _replaceColorsParameterSet.NewTextColor
: new Color {A = 255, R = 255, G = 255, B = 255}; : new Color {A = 255, R = 255, G = 255, B = 255};
}
}
public bool ReplaceTextColor public bool ReplaceTextColor
{ {
@ -114,15 +100,9 @@ namespace Filtration.ViewModels
} }
} }
public Color DisplayBackgroundColor public Color DisplayBackgroundColor => _replaceColorsParameterSet.ReplaceBackgroundColor
{
get
{
return _replaceColorsParameterSet.ReplaceBackgroundColor
? _replaceColorsParameterSet.NewBackgroundColor ? _replaceColorsParameterSet.NewBackgroundColor
: new Color { A = 255, R = 0, G = 0, B = 0 }; : new Color { A = 255, R = 0, G = 0, B = 0 };
}
}
public bool ReplaceBackgroundColor public bool ReplaceBackgroundColor
{ {
@ -145,15 +125,9 @@ namespace Filtration.ViewModels
} }
} }
public Color DisplayBorderColor public Color DisplayBorderColor => _replaceColorsParameterSet.ReplaceBorderColor
{
get
{
return _replaceColorsParameterSet.ReplaceBorderColor
? _replaceColorsParameterSet.NewBorderColor ? _replaceColorsParameterSet.NewBorderColor
: new Color { A = 255, R = 0, G = 0, B = 0 }; : new Color { A = 255, R = 0, G = 0, B = 0 };
}
}
public bool ReplaceBorderColor public bool ReplaceBorderColor
{ {
@ -165,13 +139,7 @@ namespace Filtration.ViewModels
} }
} }
public ReplaceColorsParameterSet ReplaceColorsParameterSet public ReplaceColorsParameterSet ReplaceColorsParameterSet => _replaceColorsParameterSet;
{
get
{
return _replaceColorsParameterSet;
}
}
public void Initialise(ItemFilterScript itemFilterScript) public void Initialise(ItemFilterScript itemFilterScript)
{ {

View File

@ -23,8 +23,8 @@ namespace Filtration.ViewModels
public RelayCommand OpenScriptCommand { get; private set; } public RelayCommand OpenScriptCommand { get; private set; }
public RelayCommand NewScriptCommand { get; private set; } public RelayCommand NewScriptCommand { get; private set; }
public bool IsScript { get { return false; } } public bool IsScript => false;
public bool IsTheme { get { return false; } } public bool IsTheme => false;
public Task Close() public Task Close()
{ {

View File

@ -69,7 +69,7 @@ namespace Filtration.ViewModels.ToolPanes
} }
} }
public RelayCommand FilterToSelectedBlockGroupCommand { get; private set; } public RelayCommand FilterToSelectedBlockGroupCommand { get; }
public ObservableCollection<ItemFilterBlockGroupViewModel> BlockGroupViewModels public ObservableCollection<ItemFilterBlockGroupViewModel> BlockGroupViewModels
{ {

View File

@ -34,12 +34,12 @@ namespace Filtration.ViewModels.ToolPanes
{ {
case "SelectedBlockChanged": case "SelectedBlockChanged":
{ {
OnSelectedBlockChanged(null, null); OnSelectedBlockChanged(this, EventArgs.Empty);
break; break;
} }
case "ActiveDocumentChanged": case "ActiveDocumentChanged":
{ {
OnSelectedBlockChanged(null, null); OnSelectedBlockChanged(this, EventArgs.Empty);
break; break;
} }
} }
@ -66,8 +66,7 @@ namespace Filtration.ViewModels.ToolPanes
private void OnSelectedBlockChanged(object sender, EventArgs e) private void OnSelectedBlockChanged(object sender, EventArgs e)
{ {
if (AvalonDockWorkspaceViewModel.ActiveScriptViewModel == null || if (AvalonDockWorkspaceViewModel.ActiveScriptViewModel?.SelectedBlockViewModel == null)
AvalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel == null)
{ {
PreviewText = string.Empty; PreviewText = string.Empty;
return; return;

View File

@ -42,25 +42,13 @@ namespace Filtration.ViewModels
_updateData = updateData; _updateData = updateData;
} }
public string CurrentVersion public string CurrentVersion => _currentVersionMajorPart + "." + _currentVersionMinorPart;
{
get { return _currentVersionMajorPart + "." + _currentVersionMinorPart; }
}
public string NewVersion public string NewVersion => _updateData.LatestVersionMajorPart + "." + _updateData.LatestVersionMinorPart;
{
get { return _updateData.LatestVersionMajorPart + "." + _updateData.LatestVersionMinorPart; }
}
public string ReleaseNotes public string ReleaseNotes => _updateData.ReleaseNotes;
{
get { return _updateData.ReleaseNotes; }
}
public DateTime ReleaseDate public DateTime ReleaseDate => _updateData.ReleaseDate;
{
get { return _updateData.ReleaseDate; }
}
private void OnDownloadCommand() private void OnDownloadCommand()
{ {
@ -83,10 +71,7 @@ namespace Filtration.ViewModels
private void CloseWindow() private void CloseWindow()
{ {
if (OnRequestClose != null) OnRequestClose?.Invoke(this, new EventArgs());
{
OnRequestClose(this, new EventArgs());
}
} }
} }

View File

@ -25,7 +25,7 @@ namespace Filtration.Views.AttachedProperties
static void OnSelectingItemChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) static void OnSelectingItemChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{ {
var listBox = sender as ListBox; var listBox = sender as ListBox;
if (listBox == null || listBox.SelectedItem == null) if (listBox?.SelectedItem == null)
{ {
return; return;
} }

View File

@ -12,8 +12,7 @@ namespace Filtration.Views.AvalonDock
//just for test provide a new anchorablepane //just for test provide a new anchorablepane
//if the pane is floating let the manager go ahead //if the pane is floating let the manager go ahead
LayoutAnchorablePane destPane = destinationContainer as LayoutAnchorablePane; LayoutAnchorablePane destPane = destinationContainer as LayoutAnchorablePane;
if (destinationContainer != null && if (destinationContainer?.FindParent<LayoutFloatingWindow>() != null)
destinationContainer.FindParent<LayoutFloatingWindow>() != null)
return false; return false;
if (anchorableToShow.Content is SectionBrowserViewModel) if (anchorableToShow.Content is SectionBrowserViewModel)

View File

@ -22,10 +22,7 @@ namespace Filtration.Views.Behaviors
private static void OnSelectedItemChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) private static void OnSelectedItemChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{ {
var item = e.NewValue as TreeViewItem; var item = e.NewValue as TreeViewItem;
if (item != null) item?.SetValue(TreeViewItem.IsSelectedProperty, true);
{
item.SetValue(TreeViewItem.IsSelectedProperty, true);
}
} }
#endregion #endregion

View File

@ -16,7 +16,7 @@
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary> <ResourceDictionary>
<views:BindingProxy x:Key="proxy" Data="{Binding}" /> <views:BindingProxy x:Key="Proxy" Data="{Binding}" />
<converters:BlockGroupAdvancedFillColorConverter x:Key="BlockGroupAdvancedFillColorConverter" /> <converters:BlockGroupAdvancedFillColorConverter x:Key="BlockGroupAdvancedFillColorConverter" />
<Style TargetType="{x:Type ContentPresenter}" x:Key="BlockItemFadeInStyle"> <Style TargetType="{x:Type ContentPresenter}" x:Key="BlockItemFadeInStyle">
<Setter Property="LayoutTransform"> <Setter Property="LayoutTransform">
@ -74,18 +74,18 @@
<MenuItem Header="Copy Block Style" Command="{Binding CopyBlockStyleCommand}" Icon="{StaticResource CopyIcon}" /> <MenuItem Header="Copy Block Style" Command="{Binding CopyBlockStyleCommand}" Icon="{StaticResource CopyIcon}" />
<MenuItem Header="Paste Block Style" Command="{Binding PasteBlockStyleCommand}" Icon="{StaticResource PasteIcon}" /> <MenuItem Header="Paste Block Style" Command="{Binding PasteBlockStyleCommand}" Icon="{StaticResource PasteIcon}" />
</MenuItem> </MenuItem>
<MenuItem Header="Add Block" Command="{Binding Data.AddBlockCommand, Source={StaticResource proxy}}" Icon="{StaticResource AddBlockIcon}" /> <MenuItem Header="Add Block" Command="{Binding Data.AddBlockCommand, Source={StaticResource Proxy}}" Icon="{StaticResource AddBlockIcon}" />
<MenuItem Header="Add Section" Command="{Binding Data.AddSectionCommand, Source={StaticResource proxy}}" Icon="{StaticResource AddSectionIcon}"> <MenuItem Header="Add Section" Command="{Binding Data.AddSectionCommand, Source={StaticResource Proxy}}" Icon="{StaticResource AddSectionIcon}">
</MenuItem> </MenuItem>
<Separator /> <Separator />
<MenuItem Header="Delete Block" Command="{Binding Data.DeleteBlockCommand, Source={StaticResource proxy}}" Icon="{StaticResource DeleteIcon}" /> <MenuItem Header="Delete Block" Command="{Binding Data.DeleteBlockCommand, Source={StaticResource Proxy}}" Icon="{StaticResource DeleteIcon}" />
<Separator /> <Separator />
<MenuItem Header="Move Block To Top" Command="{Binding Data.MoveBlockToTopCommand, Source={StaticResource proxy}}" Icon="{StaticResource MoveToTopIcon}" /> <MenuItem Header="Move Block To Top" Command="{Binding Data.MoveBlockToTopCommand, Source={StaticResource Proxy}}" Icon="{StaticResource MoveToTopIcon}" />
<MenuItem Header="Move Block Up" Command="{Binding Data.MoveBlockUpCommand, Source={StaticResource proxy}}" Icon="{StaticResource MoveUpIcon}" /> <MenuItem Header="Move Block Up" Command="{Binding Data.MoveBlockUpCommand, Source={StaticResource Proxy}}" Icon="{StaticResource MoveUpIcon}" />
<MenuItem Header="Move Block Down" Command="{Binding Data.MoveBlockDownCommand, Source={StaticResource proxy}}" Icon="{StaticResource MoveDownIcon}" /> <MenuItem Header="Move Block Down" Command="{Binding Data.MoveBlockDownCommand, Source={StaticResource Proxy}}" Icon="{StaticResource MoveDownIcon}" />
<MenuItem Header="Move Block To Bottom" Command="{Binding Data.MoveBlockToBottomCommand, Source={StaticResource proxy}}" Icon="{StaticResource MoveToBottomIcon}" /> <MenuItem Header="Move Block To Bottom" Command="{Binding Data.MoveBlockToBottomCommand, Source={StaticResource Proxy}}" Icon="{StaticResource MoveToBottomIcon}" />
<Separator /> <Separator />
<MenuItem Header="Replace Colors" Command="{Binding Data.ReplaceColorsCommand, Source={StaticResource proxy}}" Icon="{StaticResource ReplaceColorsIcon}" /> <MenuItem Header="Replace Colors" Command="{Binding Data.ReplaceColorsCommand, Source={StaticResource Proxy}}" Icon="{StaticResource ReplaceColorsIcon}" />
</ContextMenu.Items> </ContextMenu.Items>
</ContextMenu> </ContextMenu>
</Expander.ContextMenu> </Expander.ContextMenu>

View File

@ -1,7 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.IO; using System.IO;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using Filtration.ViewModels; using Filtration.ViewModels;

View File

@ -4,7 +4,7 @@ using Xceed.Wpf.Toolkit;
namespace Filtration.Views namespace Filtration.Views
{ {
static internal class PathOfExileColors internal static class PathOfExileColors
{ {
static PathOfExileColors() static PathOfExileColors()
{ {