Exemplo n.º 1
0
        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <param name="param">The param.</param>
        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
            });
        }
Exemplo n.º 2
0
 protected void InvokeExecuting(CancelCommandEventArgs args)
 {
     Executing?.Invoke(this, args);
 }