コード例 #1
0
ファイル: Command.cs プロジェクト: Owenx25/Backlogger
        /// <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
            });
        }
コード例 #2
0
ファイル: Command.cs プロジェクト: Owenx25/Backlogger
 protected void InvokeExecuting(CancelCommandEventArgs args)
 {
     Executing?.Invoke(this, args);
 }