2015-06-25 23:05:24 +01:00
|
|
|
|
using System;
|
2015-07-05 16:54:09 +01:00
|
|
|
|
using System.Linq;
|
2015-06-25 23:05:24 +01:00
|
|
|
|
using System.Windows.Media;
|
2015-07-06 15:33:25 +01:00
|
|
|
|
using System.Xml.Serialization;
|
2015-06-26 17:42:20 +01:00
|
|
|
|
using Filtration.ObjectModel.Enums;
|
2015-06-25 23:05:24 +01:00
|
|
|
|
|
2015-06-26 17:42:20 +01:00
|
|
|
|
namespace Filtration.ObjectModel.ThemeEditor
|
2015-06-25 23:05:24 +01:00
|
|
|
|
{
|
2015-06-26 17:42:20 +01:00
|
|
|
|
[Serializable]
|
2015-06-25 23:05:24 +01:00
|
|
|
|
public class Theme
|
|
|
|
|
{
|
2015-07-05 16:54:09 +01:00
|
|
|
|
private readonly ThemeComponentCollection _components;
|
2015-06-25 23:05:24 +01:00
|
|
|
|
|
|
|
|
|
public Theme()
|
|
|
|
|
{
|
2015-07-05 16:54:09 +01:00
|
|
|
|
_components = new ThemeComponentCollection { IsMasterCollection = false};
|
2015-06-25 23:05:24 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Name { get; set; }
|
2015-07-06 15:33:25 +01:00
|
|
|
|
|
|
|
|
|
[XmlIgnore]
|
2015-06-26 17:42:20 +01:00
|
|
|
|
public string FilePath { get; set; }
|
2015-06-25 23:05:24 +01:00
|
|
|
|
|
2015-12-13 20:17:15 +00:00
|
|
|
|
public ThemeComponentCollection Components => _components;
|
2015-06-25 23:05:24 +01:00
|
|
|
|
|
2015-06-26 17:42:20 +01:00
|
|
|
|
public bool ComponentExists(ThemeComponentType componentType, string componentName)
|
2015-06-25 23:05:24 +01:00
|
|
|
|
{
|
2015-07-05 16:54:09 +01:00
|
|
|
|
var componentCount =
|
|
|
|
|
_components.Count(c => c.ComponentName == componentName && c.ComponentType == componentType);
|
|
|
|
|
return componentCount > 0;
|
2015-06-25 23:05:24 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-06-26 17:42:20 +01:00
|
|
|
|
public void AddComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
2015-06-25 23:05:24 +01:00
|
|
|
|
{
|
2015-06-26 17:42:20 +01:00
|
|
|
|
_components.Add(new ThemeComponent(componentType, componentName, componentColor));
|
2015-06-25 23:05:24 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|