Add font size theme support & improve theme system
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.Annotations;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.ThemeEditor
|
||||
@@ -11,7 +8,6 @@ namespace Filtration.ObjectModel.ThemeEditor
|
||||
public class ColorThemeComponent : ThemeComponent
|
||||
{
|
||||
private Color _color;
|
||||
private readonly object _eventLock = new object();
|
||||
|
||||
public ColorThemeComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
||||
{
|
||||
|
||||
35
Filtration.ObjectModel/ThemeEditor/IntegerThemeComponent.cs
Normal file
35
Filtration.ObjectModel/ThemeEditor/IntegerThemeComponent.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.ThemeEditor
|
||||
{
|
||||
[Serializable]
|
||||
public class IntegerThemeComponent : ThemeComponent
|
||||
{
|
||||
private int _value;
|
||||
|
||||
public IntegerThemeComponent(ThemeComponentType componentType, string componentName, int componentValue)
|
||||
{
|
||||
if (componentName == null)
|
||||
{
|
||||
throw new ArgumentException("Null parameters not allowed in IntegerThemeComponent constructor");
|
||||
}
|
||||
|
||||
ComponentType = componentType;
|
||||
Value = componentValue;
|
||||
ComponentName = componentName;
|
||||
}
|
||||
|
||||
public int Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
OnPropertyChanged();
|
||||
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,5 +34,10 @@ namespace Filtration.ObjectModel.ThemeEditor
|
||||
{
|
||||
_components.Add(new ColorThemeComponent(componentType, componentName, componentColor));
|
||||
}
|
||||
|
||||
public void AddComponent(ThemeComponentType componentType, string componentName, int componentValue)
|
||||
{
|
||||
_components.Add(new IntegerThemeComponent(componentType, componentName, componentValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,15 +16,20 @@ namespace Filtration.ObjectModel.ThemeEditor
|
||||
return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType);
|
||||
}
|
||||
|
||||
ThemeComponent component = null;
|
||||
switch(componentType)
|
||||
var component = new ColorThemeComponent(componentType, componentName, componentColor);
|
||||
Items.Add(component);
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
public ThemeComponent AddComponent(ThemeComponentType componentType, string componentName, int componentValue)
|
||||
{
|
||||
if (ComponentExists(componentType, componentName))
|
||||
{
|
||||
case ThemeComponentType.BackgroundColor:
|
||||
case ThemeComponentType.BorderColor:
|
||||
case ThemeComponentType.TextColor:
|
||||
component = new ColorThemeComponent(componentType, componentName, componentColor);
|
||||
break;
|
||||
return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType);
|
||||
}
|
||||
|
||||
var component = new IntegerThemeComponent(componentType, componentName, componentValue);
|
||||
Items.Add(component);
|
||||
|
||||
return component;
|
||||
|
||||
Reference in New Issue
Block a user