Filtration/Filtration.ObjectModel/ThemeEditor/Theme.cs

49 lines
1.6 KiB
C#
Raw Normal View History

using System;
using System.Linq;
using System.Windows.Media;
using System.Xml.Serialization;
2015-06-26 12:42:20 -04:00
using Filtration.ObjectModel.Enums;
2015-06-26 12:42:20 -04:00
namespace Filtration.ObjectModel.ThemeEditor
{
2015-06-26 12:42:20 -04:00
[Serializable]
public class Theme
{
private readonly ThemeComponentCollection _components;
public Theme()
{
_components = new ThemeComponentCollection { IsMasterCollection = false};
}
public string Name { get; set; }
[XmlIgnore]
2015-06-26 12:42:20 -04:00
public string FilePath { get; set; }
public ThemeComponentCollection Components => _components;
2015-06-26 12:42:20 -04:00
public bool ComponentExists(ThemeComponentType componentType, string componentName)
{
var componentCount =
_components.Count(c => c.ComponentName == componentName && c.ComponentType == componentType);
return componentCount > 0;
}
2015-06-26 12:42:20 -04:00
public void AddComponent(ThemeComponentType componentType, string componentName, Color componentColor)
{
_components.Add(new ColorThemeComponent(componentType, componentName, componentColor));
}
public void AddComponent(ThemeComponentType componentType, string componentName, int componentValue)
{
_components.Add(new IntegerThemeComponent(componentType, componentName, componentValue));
}
2018-08-26 13:24:13 -04:00
public void AddComponent(ThemeComponentType componentType, string componentName, string componentValue, int componentSecondValue)
{
_components.Add(new StrIntThemeComponent(componentType, componentName, componentValue, componentSecondValue));
}
}
}