Implemented ThemeComponent reading/saving in translation layer
This commit is contained in:
33
Filtration.ObjectModel/ThemeEditor/Theme.cs
Normal file
33
Filtration.ObjectModel/ThemeEditor/Theme.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.ThemeEditor.Models
|
||||
{
|
||||
public class Theme
|
||||
{
|
||||
private readonly List<ThemeComponent> _components;
|
||||
|
||||
public Theme()
|
||||
{
|
||||
_components = new List<ThemeComponent>();
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public IEnumerable<ThemeComponent> Components
|
||||
{
|
||||
get { return _components; }
|
||||
}
|
||||
|
||||
public bool ComponentExists(Type targetType, string componentName)
|
||||
{
|
||||
return _components.Exists(c => c.ComponentName == componentName && c.TargetType == targetType);
|
||||
}
|
||||
|
||||
public void AddComponent(Type targetType, string componentName, Color componentColor)
|
||||
{
|
||||
_components.Add(new ThemeComponent(targetType, componentName, componentColor));
|
||||
}
|
||||
}
|
||||
}
|
||||
24
Filtration.ObjectModel/ThemeEditor/ThemeComponent.cs
Normal file
24
Filtration.ObjectModel/ThemeEditor/ThemeComponent.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.ThemeEditor.Models
|
||||
{
|
||||
public class ThemeComponent
|
||||
{
|
||||
public ThemeComponent(Type targetType, string componentName, Color componentColor)
|
||||
{
|
||||
if (targetType == null || componentName == null || componentColor == null)
|
||||
{
|
||||
throw new ArgumentException("Null parameters not allowed in ThemeComponent constructor");
|
||||
}
|
||||
|
||||
TargetType = targetType;
|
||||
Color = componentColor;
|
||||
ComponentName = componentName;
|
||||
}
|
||||
|
||||
public string ComponentName { get; set; }
|
||||
public Type TargetType { get; private set; }
|
||||
public Color Color { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user