Implemented opening/saving themes
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ThemeEditor.Models;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
|
||||
14
Filtration.ObjectModel/Enums/ThemeComponentType.cs
Normal file
14
Filtration.ObjectModel/Enums/ThemeComponentType.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.ObjectModel.Enums
|
||||
{
|
||||
public enum ThemeComponentType
|
||||
{
|
||||
[Description("Text")]
|
||||
TextColor,
|
||||
[Description("Background")]
|
||||
BackgroundColor,
|
||||
[Description("Border")]
|
||||
BorderColor
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,7 @@
|
||||
<Compile Include="Enums\FilterType.cs" />
|
||||
<Compile Include="Enums\ItemRarity.cs" />
|
||||
<Compile Include="Enums\SocketColor.cs" />
|
||||
<Compile Include="Enums\ThemeComponentType.cs" />
|
||||
<Compile Include="Extensions\EnumHelper.cs" />
|
||||
<Compile Include="IAudioVisualBlockItem.cs" />
|
||||
<Compile Include="IItemFilterBlockItem.cs" />
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
using Filtration.ThemeEditor.Models;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
|
||||
namespace Filtration.ObjectModel
|
||||
{
|
||||
|
||||
@@ -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