Add new filter fuatures

This commit is contained in:
azakhi
2018-08-29 20:12:02 +03:00
parent a09f0a5090
commit 78b4ddc862
78 changed files with 911 additions and 231 deletions

View File

@@ -0,0 +1,47 @@
using System;
using Filtration.ObjectModel.Enums;
namespace Filtration.ObjectModel.ThemeEditor
{
[Serializable]
public class EffectColorThemeComponent : ThemeComponent
{
private EffectColor _effectColor;
private bool _temporary;
public EffectColorThemeComponent(ThemeComponentType componentType, string componentName, EffectColor componentEffectColor, bool componentTemporary)
{
if (componentName == null)
{
throw new ArgumentException("Null parameters not allowed in EffectColorThemeComponent constructor");
}
ComponentType = componentType;
ComponentName = componentName;
EffectColor = componentEffectColor;
Temporary = componentTemporary;
}
public EffectColor EffectColor
{
get { return _effectColor; }
set
{
_effectColor = value;
OnPropertyChanged();
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
}
}
public bool Temporary
{
get { return _temporary; }
set
{
_temporary = value;
OnPropertyChanged();
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
}
}
}
}

View File

@@ -0,0 +1,60 @@
using System;
using Filtration.ObjectModel.Enums;
namespace Filtration.ObjectModel.ThemeEditor
{
[Serializable]
public class IconThemeComponent : ThemeComponent
{
private IconSize _iconSize;
private IconColor _iconColor;
private IconShape _iconShape;
public IconThemeComponent(ThemeComponentType componentType, string componentName, IconSize componentIconSize, IconColor componentIconColor, IconShape componentIconShape)
{
if (componentName == null)
{
throw new ArgumentException("Null parameters not allowed in IconThemeComponent constructor");
}
ComponentType = componentType;
ComponentName = componentName;
IconSize = componentIconSize;
IconColor = componentIconColor;
IconShape = componentIconShape;
}
public IconSize IconSize
{
get { return _iconSize; }
set
{
_iconSize = value;
OnPropertyChanged();
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
}
}
public IconColor IconColor
{
get { return _iconColor; }
set
{
_iconColor = value;
OnPropertyChanged();
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
}
}
public IconShape IconShape
{
get { return _iconShape; }
set
{
_iconShape = value;
OnPropertyChanged();
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
}
}
}
}

View File

@@ -61,6 +61,32 @@ namespace Filtration.ObjectModel.ThemeEditor
return component;
}
public ThemeComponent AddComponent(ThemeComponentType componentType, string componentName, IconSize componentIconSize, IconColor componentIconColor, IconShape componentIconShape)
{
if (ComponentExists(componentType, componentName))
{
return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType);
}
var component = new IconThemeComponent(componentType, componentName, componentIconSize, componentIconColor, componentIconShape);
Items.Add(component);
return component;
}
public ThemeComponent AddComponent(ThemeComponentType componentType, string componentName, EffectColor componentEffectColor, bool componentTemporary)
{
if (ComponentExists(componentType, componentName))
{
return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType);
}
var component = new EffectColorThemeComponent(componentType, componentName, componentEffectColor, componentTemporary);
Items.Add(component);
return component;
}
private bool ComponentExists(ThemeComponentType componentType, string componentName)
{
var componentCount =