2018-08-25 08:52:16 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using Filtration.ObjectModel.ThemeEditor;
|
2015-06-04 13:15:54 -04:00
|
|
|
|
|
2015-06-24 14:57:16 -04:00
|
|
|
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
2015-06-04 13:15:54 -04:00
|
|
|
|
{
|
2018-08-25 08:52:16 -04:00
|
|
|
|
public abstract class IntegerBlockItem : BlockItemBase, IAudioVisualBlockItem, IBlockItemWithTheme
|
2015-06-04 13:15:54 -04:00
|
|
|
|
{
|
|
|
|
|
private int _value;
|
2018-08-25 08:52:16 -04:00
|
|
|
|
private ThemeComponent _themeComponent;
|
2015-06-04 13:15:54 -04:00
|
|
|
|
|
|
|
|
|
protected IntegerBlockItem()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected IntegerBlockItem(int value)
|
|
|
|
|
{
|
|
|
|
|
Value = value;
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-25 08:52:16 -04:00
|
|
|
|
public override string OutputText => PrefixText + " " + Value + (ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty);
|
2015-06-23 17:21:10 -04:00
|
|
|
|
|
2015-12-13 15:17:15 -05:00
|
|
|
|
public override string SummaryText => string.Empty;
|
|
|
|
|
public override Color SummaryBackgroundColor => Colors.Transparent;
|
|
|
|
|
public override Color SummaryTextColor => Colors.Transparent;
|
2015-06-04 13:15:54 -04:00
|
|
|
|
|
|
|
|
|
public abstract int Minimum { get; }
|
|
|
|
|
public abstract int Maximum { get; }
|
|
|
|
|
|
2018-08-25 08:52:16 -04:00
|
|
|
|
public ThemeComponent ThemeComponent
|
|
|
|
|
{
|
|
|
|
|
get { return _themeComponent; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (_themeComponent == value) { return; }
|
|
|
|
|
|
|
|
|
|
if (_themeComponent != null)
|
|
|
|
|
{
|
|
|
|
|
_themeComponent.ThemeComponentUpdated -= OnThemeComponentUpdated;
|
|
|
|
|
_themeComponent.ThemeComponentDeleted -= OnThemeComponentDeleted;
|
|
|
|
|
}
|
|
|
|
|
if (value != null)
|
|
|
|
|
{
|
|
|
|
|
value.ThemeComponentUpdated += OnThemeComponentUpdated;
|
|
|
|
|
value.ThemeComponentDeleted += OnThemeComponentDeleted;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_themeComponent = value;
|
|
|
|
|
OnPropertyChanged();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-04 13:15:54 -04:00
|
|
|
|
public int Value
|
|
|
|
|
{
|
|
|
|
|
get { return _value; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_value = value;
|
2016-08-20 16:17:12 -04:00
|
|
|
|
IsDirty = true;
|
2015-06-04 13:15:54 -04:00
|
|
|
|
OnPropertyChanged();
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-08-25 08:52:16 -04:00
|
|
|
|
|
|
|
|
|
private void OnThemeComponentUpdated(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Value = ((IntegerBlockItem)sender).Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnThemeComponentDeleted(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ThemeComponent = null;
|
|
|
|
|
}
|
2015-06-04 13:15:54 -04:00
|
|
|
|
}
|
|
|
|
|
}
|