Improved dirty script detection to include modifications to blocks rather than just block additions/removals
This commit is contained in:
@@ -4,9 +4,10 @@ using Filtration.ObjectModel.Extensions;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
public class ActionBlockItem : BlockItemBase
|
||||
public sealed class ActionBlockItem : BlockItemBase
|
||||
{
|
||||
private BlockAction _action;
|
||||
private bool _isDirty;
|
||||
|
||||
public ActionBlockItem(BlockAction action)
|
||||
{
|
||||
@@ -19,10 +20,11 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
set
|
||||
{
|
||||
_action = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged("SummaryText");
|
||||
OnPropertyChanged("SummaryBackgroundColor");
|
||||
OnPropertyChanged("SummaryTextColor");
|
||||
OnPropertyChanged(nameof(SummaryText));
|
||||
OnPropertyChanged(nameof(SummaryBackgroundColor));
|
||||
OnPropertyChanged(nameof(SummaryText));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +44,16 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
|
||||
public override int SortOrder => 0;
|
||||
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return _isDirty; }
|
||||
protected set
|
||||
{
|
||||
_isDirty = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void ToggleAction()
|
||||
{
|
||||
Action = Action == BlockAction.Show ? BlockAction.Hide : BlockAction.Show;
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
public abstract Color SummaryBackgroundColor { get; }
|
||||
public abstract Color SummaryTextColor { get; }
|
||||
public abstract int SortOrder { get; }
|
||||
public abstract bool IsDirty { get; protected set; }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
|
||||
public override string SummaryText => string.Empty;
|
||||
|
||||
public override bool IsDirty { get; protected set; }
|
||||
|
||||
public ThemeComponent ThemeComponent
|
||||
{
|
||||
get { return _themeComponent; }
|
||||
@@ -56,6 +58,7 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
set
|
||||
{
|
||||
_color = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,12 +23,15 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||
public override Color SummaryTextColor => Colors.Transparent;
|
||||
|
||||
public override bool IsDirty { get; protected set; }
|
||||
|
||||
public int Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
@@ -39,6 +42,7 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
set
|
||||
{
|
||||
_secondValue = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,12 +24,15 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
public abstract int Minimum { get; }
|
||||
public abstract int Maximum { get; }
|
||||
|
||||
public override bool IsDirty { get; protected set; }
|
||||
|
||||
public int Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
public abstract int Minimum { get; }
|
||||
public abstract int Maximum { get; }
|
||||
|
||||
public override bool IsDirty { get; protected set; }
|
||||
|
||||
public NumericFilterPredicate FilterPredicate
|
||||
{
|
||||
get { return _filterPredicate; }
|
||||
@@ -38,8 +40,9 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
|
||||
private void OnFilterPredicateChanged(object sender, EventArgs e)
|
||||
{
|
||||
OnPropertyChanged("FilterPredicate");
|
||||
OnPropertyChanged("SummaryText");
|
||||
IsDirty = true;
|
||||
OnPropertyChanged(nameof(FilterPredicate));
|
||||
OnPropertyChanged(nameof(SummaryText));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,10 +30,13 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
|
||||
public ObservableCollection<string> Items { get; protected set; }
|
||||
|
||||
public override bool IsDirty { get; protected set; }
|
||||
|
||||
private void OnItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
OnPropertyChanged("Items");
|
||||
OnPropertyChanged("SummaryText");
|
||||
IsDirty = true;
|
||||
OnPropertyChanged(nameof(Items));
|
||||
OnPropertyChanged(nameof(SummaryText));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
namespace Filtration.ObjectModel
|
||||
{
|
||||
public interface IAudioVisualBlockItem
|
||||
public interface IAudioVisualBlockItem : IItemFilterBlockItem
|
||||
{
|
||||
event PropertyChangedEventHandler PropertyChanged;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ namespace Filtration.ObjectModel
|
||||
{
|
||||
public interface IItemFilterBlockItem : INotifyPropertyChanged
|
||||
{
|
||||
event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
string PrefixText { get; }
|
||||
string OutputText { get; }
|
||||
string DisplayHeading { get; }
|
||||
@@ -13,5 +15,6 @@ namespace Filtration.ObjectModel
|
||||
Color SummaryTextColor { get; }
|
||||
int MaximumAllowed { get; }
|
||||
int SortOrder { get; }
|
||||
bool IsDirty { get; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user