Example #1
0
        private void OnPreviewInvoke(object sender, PreviewInvokeEventArgs e)
        {
            ICondition condition = Condition;

            if (condition != null)
            {
                e.Cancelling = !condition.Evaluate();
            }
        }
Example #2
0
        /// <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);
            }
        }