diff options
Diffstat (limited to 'Xamarin.Forms.Core/Interactivity/TriggerAction.cs')
-rw-r--r-- | Xamarin.Forms.Core/Interactivity/TriggerAction.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core/Interactivity/TriggerAction.cs b/Xamarin.Forms.Core/Interactivity/TriggerAction.cs new file mode 100644 index 00000000..bb9dc08f --- /dev/null +++ b/Xamarin.Forms.Core/Interactivity/TriggerAction.cs @@ -0,0 +1,37 @@ +using System; + +namespace Xamarin.Forms +{ + public abstract class TriggerAction + { + internal TriggerAction(Type associatedType) + { + if (associatedType == null) + throw new ArgumentNullException("associatedType"); + AssociatedType = associatedType; + } + + protected Type AssociatedType { get; private set; } + + protected abstract void Invoke(object sender); + + internal virtual void DoInvoke(object sender) + { + Invoke(sender); + } + } + + public abstract class TriggerAction<T> : TriggerAction where T : BindableObject + { + protected TriggerAction() : base(typeof(T)) + { + } + + protected override void Invoke(object sender) + { + Invoke((T)sender); + } + + protected abstract void Invoke(T sender); + } +}
\ No newline at end of file |