Add alert sound theme support
This commit is contained in:
48
Filtration.ObjectModel/ThemeEditor/StrIntThemeComponent.cs
Normal file
48
Filtration.ObjectModel/ThemeEditor/StrIntThemeComponent.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.ThemeEditor
|
||||
{
|
||||
[Serializable]
|
||||
public class StrIntThemeComponent : ThemeComponent
|
||||
{
|
||||
private string _value;
|
||||
private int _secondValue;
|
||||
|
||||
public StrIntThemeComponent(ThemeComponentType componentType, string componentName, string componentValue, int componentSecondValue)
|
||||
{
|
||||
if (componentName == null || componentValue == null)
|
||||
{
|
||||
throw new ArgumentException("Null parameters not allowed in StrIntThemeComponent constructor");
|
||||
}
|
||||
|
||||
ComponentType = componentType;
|
||||
Value = componentValue;
|
||||
SecondValue = componentSecondValue;
|
||||
ComponentName = componentName;
|
||||
}
|
||||
|
||||
public string Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
OnPropertyChanged();
|
||||
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public int SecondValue
|
||||
{
|
||||
get { return _secondValue; }
|
||||
set
|
||||
{
|
||||
_secondValue = value;
|
||||
OnPropertyChanged();
|
||||
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,5 +39,10 @@ namespace Filtration.ObjectModel.ThemeEditor
|
||||
{
|
||||
_components.Add(new IntegerThemeComponent(componentType, componentName, componentValue));
|
||||
}
|
||||
|
||||
public void AddComponent(ThemeComponentType componentType, string componentName, string componentValue, int componentSecondValue)
|
||||
{
|
||||
_components.Add(new StrIntThemeComponent(componentType, componentName, componentValue, componentSecondValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,19 @@ namespace Filtration.ObjectModel.ThemeEditor
|
||||
return component;
|
||||
}
|
||||
|
||||
public ThemeComponent AddComponent(ThemeComponentType componentType, string componentName, string componentValue, int componentSecondValue)
|
||||
{
|
||||
if (ComponentExists(componentType, componentName))
|
||||
{
|
||||
return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType);
|
||||
}
|
||||
|
||||
var component = new StrIntThemeComponent(componentType, componentName, componentValue, componentSecondValue);
|
||||
Items.Add(component);
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
private bool ComponentExists(ThemeComponentType componentType, string componentName)
|
||||
{
|
||||
var componentCount =
|
||||
|
||||
Reference in New Issue
Block a user