2015-06-25 18:05:24 -04:00
|
|
|
|
using System;
|
2015-07-05 17:43:17 -04:00
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Runtime.CompilerServices;
|
2015-06-25 18:05:24 -04:00
|
|
|
|
using System.Windows.Media;
|
2015-07-05 17:43:17 -04:00
|
|
|
|
using Filtration.ObjectModel.Annotations;
|
2015-06-26 12:42:20 -04:00
|
|
|
|
using Filtration.ObjectModel.Enums;
|
2015-06-25 18:05:24 -04:00
|
|
|
|
|
2015-06-26 12:42:20 -04:00
|
|
|
|
namespace Filtration.ObjectModel.ThemeEditor
|
2015-06-25 18:05:24 -04:00
|
|
|
|
{
|
2015-06-26 12:42:20 -04:00
|
|
|
|
[Serializable]
|
2015-07-05 17:43:17 -04:00
|
|
|
|
public class ThemeComponent : INotifyPropertyChanged
|
2015-06-25 18:05:24 -04:00
|
|
|
|
{
|
2015-07-05 17:43:17 -04:00
|
|
|
|
private Color _color;
|
|
|
|
|
|
2015-06-26 12:42:20 -04:00
|
|
|
|
public ThemeComponent()
|
2015-06-25 18:05:24 -04:00
|
|
|
|
{
|
2015-06-26 12:42:20 -04:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ThemeComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
|
|
|
|
{
|
|
|
|
|
if (componentName == null || componentColor == null)
|
2015-06-25 18:05:24 -04:00
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException("Null parameters not allowed in ThemeComponent constructor");
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-26 12:42:20 -04:00
|
|
|
|
ComponentType = componentType;
|
2015-06-25 18:05:24 -04:00
|
|
|
|
Color = componentColor;
|
|
|
|
|
ComponentName = componentName;
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-05 17:43:17 -04:00
|
|
|
|
public event EventHandler ThemeComponentUpdated;
|
|
|
|
|
public event EventHandler ThemeComponentDeleted;
|
|
|
|
|
|
2015-06-25 18:05:24 -04:00
|
|
|
|
public string ComponentName { get; set; }
|
2015-07-05 17:43:17 -04:00
|
|
|
|
public ThemeComponentType ComponentType{ get; private set; }
|
|
|
|
|
|
|
|
|
|
public Color Color
|
|
|
|
|
{
|
|
|
|
|
get { return _color; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_color = value;
|
|
|
|
|
OnPropertyChanged();
|
|
|
|
|
if (ThemeComponentUpdated != null)
|
|
|
|
|
{
|
|
|
|
|
ThemeComponentUpdated.Invoke(this, EventArgs.Empty);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void TerminateComponent()
|
|
|
|
|
{
|
|
|
|
|
if (ThemeComponentDeleted != null)
|
|
|
|
|
{
|
|
|
|
|
ThemeComponentDeleted.Invoke(this, EventArgs.Empty);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
|
|
|
|
|
|
[NotifyPropertyChangedInvocator]
|
|
|
|
|
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
|
|
|
|
{
|
|
|
|
|
var handler = PropertyChanged;
|
|
|
|
|
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
|
|
|
|
}
|
2015-06-25 18:05:24 -04:00
|
|
|
|
}
|
|
|
|
|
}
|