More work on item filter processing

This commit is contained in:
Ben Wallis
2015-12-28 17:30:34 +00:00
parent 89e98fc8c6
commit 1bdc8bf6fd
21 changed files with 420 additions and 216 deletions

View File

@@ -6,7 +6,20 @@ using Filtration.ObjectModel.Enums;
namespace Filtration.ObjectModel
{
public class ItemFilterBlock
public interface IItemFilterBlock
{
bool Enabled { get; set; }
string Description { get; set; }
ItemFilterBlockGroup BlockGroup { get; set; }
BlockAction Action { get; set; }
ObservableCollection<IItemFilterBlockItem> BlockItems { get; }
int BlockCount(Type type);
bool AddBlockItemAllowed(Type type);
bool HasBlockItemOfType<T>();
bool HasBlockGroupInParentHierarchy(ItemFilterBlockGroup targetBlockGroup, ItemFilterBlockGroup startingBlockGroup);
}
public class ItemFilterBlock : IItemFilterBlock
{
private ItemFilterBlockGroup _blockGroup;

View File

@@ -9,7 +9,7 @@ namespace Filtration.ObjectModel
{
public interface IItemFilterScript
{
ObservableCollection<ItemFilterBlock> ItemFilterBlocks { get; }
ObservableCollection<IItemFilterBlock> ItemFilterBlocks { get; }
ObservableCollection<ItemFilterBlockGroup> ItemFilterBlockGroups { get; }
ThemeComponentCollection ThemeComponents { get; set; }
string FilePath { get; set; }
@@ -23,7 +23,7 @@ namespace Filtration.ObjectModel
{
public ItemFilterScript()
{
ItemFilterBlocks = new ObservableCollection<ItemFilterBlock>();
ItemFilterBlocks = new ObservableCollection<IItemFilterBlock>();
ItemFilterBlockGroups = new ObservableCollection<ItemFilterBlockGroup>
{
new ItemFilterBlockGroup("Root", null)
@@ -31,7 +31,7 @@ namespace Filtration.ObjectModel
ThemeComponents = new ThemeComponentCollection { IsMasterCollection = true};
}
public ObservableCollection<ItemFilterBlock> ItemFilterBlocks { get; }
public ObservableCollection<IItemFilterBlock> ItemFilterBlocks { get; }
public ObservableCollection<ItemFilterBlockGroup> ItemFilterBlockGroups { get; }
public ThemeComponentCollection ThemeComponents { get; set; }
@@ -76,7 +76,7 @@ namespace Filtration.ObjectModel
}
}
private bool BlockIsColorReplacementCandidate(ReplaceColorsParameterSet replaceColorsParameterSet, ItemFilterBlock block)
private bool BlockIsColorReplacementCandidate(ReplaceColorsParameterSet replaceColorsParameterSet, IItemFilterBlock block)
{
var textColorItem = block.HasBlockItemOfType<TextColorBlockItem>()
? block.BlockItems.OfType<TextColorBlockItem>().First()