diff options
Diffstat (limited to 'Xamarin.Forms.Core/Interactivity/Condition.cs')
-rw-r--r-- | Xamarin.Forms.Core/Interactivity/Condition.cs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core/Interactivity/Condition.cs b/Xamarin.Forms.Core/Interactivity/Condition.cs new file mode 100644 index 00000000..aad921cf --- /dev/null +++ b/Xamarin.Forms.Core/Interactivity/Condition.cs @@ -0,0 +1,51 @@ +using System; + +namespace Xamarin.Forms +{ + public abstract class Condition + { + Action<BindableObject, bool, bool> _conditionChanged; + + bool _isSealed; + + internal Condition() + { + } + + internal Action<BindableObject, bool, bool> ConditionChanged + { + get { return _conditionChanged; } + set + { + if (_conditionChanged == value) + return; + if (_conditionChanged != null) + throw new InvalidOperationException("The same condition instance can not be reused"); + _conditionChanged = value; + } + } + + internal bool IsSealed + { + get { return _isSealed; } + set + { + if (_isSealed == value) + return; + if (!value) + throw new InvalidOperationException("What is sealed can not be unsealed."); + _isSealed = value; + OnSealed(); + } + } + + internal abstract bool GetState(BindableObject bindable); + + internal virtual void OnSealed() + { + } + + internal abstract void SetUp(BindableObject bindable); + internal abstract void TearDown(BindableObject bindable); + } +}
\ No newline at end of file |