2015-06-25 18:05:24 -04:00
|
|
|
|
using System;
|
2015-07-05 11:54:09 -04:00
|
|
|
|
using System.Linq;
|
2015-06-25 18:05:24 -04:00
|
|
|
|
using System.Windows.Media;
|
2015-07-06 10:33:25 -04:00
|
|
|
|
using System.Xml.Serialization;
|
2015-06-26 12:42:20 -04:00
|
|
|
|
using Filtration.ObjectModel.Enums;
|
2015-06-25 18:05:24 -04:00
|
|
|
|
|
2015-06-26 12:42:20 -04:00
|
|
|
|
namespace Filtration.ObjectModel.ThemeEditor
|
2015-06-25 18:05:24 -04:00
|
|
|
|
{
|
2015-06-26 12:42:20 -04:00
|
|
|
|
[Serializable]
|
2018-11-28 16:50:42 -05:00
|
|
|
|
[XmlInclude(typeof(ColorThemeComponent))]
|
|
|
|
|
[XmlInclude(typeof(EffectColorThemeComponent))]
|
|
|
|
|
[XmlInclude(typeof(IconThemeComponent))]
|
|
|
|
|
[XmlInclude(typeof(IntegerThemeComponent))]
|
|
|
|
|
[XmlInclude(typeof(StringThemeComponent))]
|
|
|
|
|
[XmlInclude(typeof(StrIntThemeComponent))]
|
2015-06-25 18:05:24 -04:00
|
|
|
|
public class Theme
|
|
|
|
|
{
|
|
|
|
|
public Theme()
|
|
|
|
|
{
|
2018-11-28 16:50:42 -05:00
|
|
|
|
Components = new ThemeComponentCollection { IsMasterCollection = false};
|
2015-06-25 18:05:24 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Name { get; set; }
|
2015-07-06 10:33:25 -04:00
|
|
|
|
|
|
|
|
|
[XmlIgnore]
|
2015-06-26 12:42:20 -04:00
|
|
|
|
public string FilePath { get; set; }
|
2015-06-25 18:05:24 -04:00
|
|
|
|
|
2018-11-28 16:50:42 -05:00
|
|
|
|
public ThemeComponentCollection Components { get; set; }
|
2015-06-25 18:05:24 -04:00
|
|
|
|
|
2015-06-26 12:42:20 -04:00
|
|
|
|
public bool ComponentExists(ThemeComponentType componentType, string componentName)
|
2015-06-25 18:05:24 -04:00
|
|
|
|
{
|
2015-07-05 11:54:09 -04:00
|
|
|
|
var componentCount =
|
2018-11-28 16:50:42 -05:00
|
|
|
|
Components.Count(c => c.ComponentName == componentName && c.ComponentType == componentType);
|
2015-07-05 11:54:09 -04:00
|
|
|
|
return componentCount > 0;
|
2015-06-25 18:05:24 -04:00
|
|
|
|
}
|
|
|
|
|
|
2015-06-26 12:42:20 -04:00
|
|
|
|
public void AddComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
2015-06-25 18:05:24 -04:00
|
|
|
|
{
|
2018-11-28 16:50:42 -05:00
|
|
|
|
Components.Add(new ColorThemeComponent(componentType, componentName, componentColor));
|
2015-06-25 18:05:24 -04:00
|
|
|
|
}
|
2018-08-25 08:52:16 -04:00
|
|
|
|
|
|
|
|
|
public void AddComponent(ThemeComponentType componentType, string componentName, int componentValue)
|
|
|
|
|
{
|
2018-11-28 16:50:42 -05:00
|
|
|
|
Components.Add(new IntegerThemeComponent(componentType, componentName, componentValue));
|
2018-08-25 08:52:16 -04:00
|
|
|
|
}
|
2018-08-26 13:24:13 -04:00
|
|
|
|
|
|
|
|
|
public void AddComponent(ThemeComponentType componentType, string componentName, string componentValue, int componentSecondValue)
|
|
|
|
|
{
|
2018-11-28 16:50:42 -05:00
|
|
|
|
Components.Add(new StrIntThemeComponent(componentType, componentName, componentValue, componentSecondValue));
|
2018-08-26 13:24:13 -04:00
|
|
|
|
}
|
2015-06-25 18:05:24 -04:00
|
|
|
|
}
|
|
|
|
|
}
|