コード例 #1
0
        public virtual void DoExecute(object param)
        {
            //  Invoke the executing command, allowing the command to be cancelled.
            CancelCommandEventArgs args = new CancelCommandEventArgs()
            {
                Parameter = param, Cancel = false
            };

            InvokeExecuting(args);

            //  If the event has been cancelled, bail now.
            if (args.Cancel)
            {
                return;
            }

            //  Call the action or the parameterized action, whichever has been set.
            InvokeAction(param);

            //  Call the executed function.
            InvokeExecuted(new CommandEventArgs()
            {
                Parameter = param
            });
        }
コード例 #2
0
        protected void InvokeExecuting(CancelCommandEventArgs args)
        {
            CancelCommandEventHandler executing = Executing;

            //  Call the executed event.
            if (executing != null)
            {
                executing(this, args);
            }
        }