private void OnPreviewInvoke(object sender, PreviewInvokeEventArgs e) { ICondition condition = Condition; if (condition != null) { e.Cancelling = !condition.Evaluate(); } }
/// <summary> /// Invoke all actions associated with this trigger /// </summary> protected void InvokeActions(object parameter) { if (PreviewInvoke != null) { PreviewInvokeEventArgs previewInvokeEventArgs = new PreviewInvokeEventArgs(); PreviewInvoke(this, previewInvokeEventArgs); if (previewInvokeEventArgs.Cancelling) { return; } } foreach (TriggerAction triggerAction in Actions) { triggerAction.CallInvoke(parameter); } }