Added untracked files

This commit is contained in:
Ben
2015-07-02 17:57:43 +01:00
parent c3d11da155
commit 0bc3cac585
19 changed files with 770 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
using System;
using System.Globalization;
using System.Windows.Data;
using Filtration.ObjectModel.BlockItemTypes;
using Filtration.ObjectModel.Enums;
using Filtration.ObjectModel.Extensions;
namespace Filtration.ThemeEditor.Converters
{
public class ThemeComponentTypeToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return string.Empty;
}
var type = (ThemeComponentType) value;
return type.GetAttributeDescription();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,40 @@
using System.IO;
using System.Xml.Serialization;
using Filtration.ObjectModel.ThemeEditor;
namespace Filtration.ThemeEditor.Services
{
internal interface IThemePersistenceService
{
Theme LoadTheme(string filePath);
void SaveTheme(Theme theme, string filePath);
}
internal class ThemePersistenceService : IThemePersistenceService
{
public Theme LoadTheme(string filePath)
{
var xmlSerializer = new XmlSerializer(typeof(Theme));
Theme loadedTheme;
using (Stream reader = new FileStream(filePath, FileMode.Open))
{
loadedTheme = (Theme)xmlSerializer.Deserialize(reader);
}
loadedTheme.FilePath = filePath;
return loadedTheme;
}
public void SaveTheme(Theme theme, string filePath)
{
var xmlSerializer = new XmlSerializer(typeof(Theme));
using (Stream writer = new FileStream(filePath, FileMode.Create))
{
xmlSerializer.Serialize(writer, theme);
}
}
}
}

View File

@@ -0,0 +1,19 @@
using System.Windows.Media;
using Filtration.ObjectModel.Enums;
namespace Filtration.ThemeEditor.ViewModels
{
public interface IThemeComponentViewModel
{
string ComponentName { get; set; }
ThemeComponentType ComponentType { get; set; }
Color Color { get; set; }
}
public class ThemeComponentViewModel : IThemeComponentViewModel
{
public string ComponentName { get; set; }
public ThemeComponentType ComponentType { get; set; }
public Color Color { get; set; }
}
}