Implemented opening/saving themes
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ThemeEditor.Models
|
||||
namespace Filtration.ObjectModel.ThemeEditor
|
||||
{
|
||||
[Serializable]
|
||||
public class Theme
|
||||
{
|
||||
private readonly List<ThemeComponent> _components;
|
||||
@@ -14,20 +16,21 @@ namespace Filtration.ThemeEditor.Models
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
|
||||
public IEnumerable<ThemeComponent> Components
|
||||
public List<ThemeComponent> Components
|
||||
{
|
||||
get { return _components; }
|
||||
}
|
||||
|
||||
public bool ComponentExists(Type targetType, string componentName)
|
||||
public bool ComponentExists(ThemeComponentType componentType, string componentName)
|
||||
{
|
||||
return _components.Exists(c => c.ComponentName == componentName && c.TargetType == targetType);
|
||||
return _components.Exists(c => c.ComponentName == componentName && c.ComponentType == componentType);
|
||||
}
|
||||
|
||||
public void AddComponent(Type targetType, string componentName, Color componentColor)
|
||||
public void AddComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
||||
{
|
||||
_components.Add(new ThemeComponent(targetType, componentName, componentColor));
|
||||
_components.Add(new ThemeComponent(componentType, componentName, componentColor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,31 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ThemeEditor.Models
|
||||
namespace Filtration.ObjectModel.ThemeEditor
|
||||
{
|
||||
[Serializable]
|
||||
public class ThemeComponent
|
||||
{
|
||||
public ThemeComponent(Type targetType, string componentName, Color componentColor)
|
||||
public ThemeComponent()
|
||||
{
|
||||
if (targetType == null || componentName == null || componentColor == null)
|
||||
|
||||
}
|
||||
|
||||
public ThemeComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
||||
{
|
||||
if (componentName == null || componentColor == null)
|
||||
{
|
||||
throw new ArgumentException("Null parameters not allowed in ThemeComponent constructor");
|
||||
}
|
||||
|
||||
TargetType = targetType;
|
||||
ComponentType = componentType;
|
||||
Color = componentColor;
|
||||
ComponentName = componentName;
|
||||
}
|
||||
|
||||
public string ComponentName { get; set; }
|
||||
public Type TargetType { get; private set; }
|
||||
public ThemeComponentType ComponentType{ get; set; }
|
||||
public Color Color { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user