/// <summary> /// 执行这个命令 /// </summary> /// <param name="param"></param> internal void Execute() { //调试阶段如果接住了异常,会比较难以调试,所以调试期关闭异常事件。。 if (!RafyEnvironment.IsDebuggingEnabled) { try { this.OnExecuting(); this.ExecuteCore(); this.OnExecuted(new CommandExecutedArgs(this.Parameter)); } catch (Exception ex) { var args = new CommandExecuteFailedArgs(ex, this.Parameter); this.OnExecuteFailed(args); if (!args.Cancel) { throw ex; } } } else { this.OnExecuting(); this.ExecuteCore(); this.OnExecuted(new CommandExecutedArgs(this.Parameter)); } }
protected virtual void OnExecuteFailed(CommandExecuteFailedArgs e) { var handler = this.ExecuteFailed; if (handler != null) { handler(this, e); } }
protected virtual void OnExecuteFailed(CommandExecuteFailedArgs e) { var handler = this.ExecuteFailed; if (handler != null) handler(this, e); }
/// <summary> /// 执行这个命令 /// </summary> /// <param name="param"></param> internal void Execute() { //调试阶段如果接住了异常,会比较难以调试,所以调试期关闭异常事件。。 if (!RafyEnvironment.IsDebuggingEnabled) { try { this.OnExecuting(); this.ExecuteCore(); this.OnExecuted(new CommandExecutedArgs(this.Parameter)); } catch (Exception ex) { var args = new CommandExecuteFailedArgs(ex, this.Parameter); this.OnExecuteFailed(args); if (!args.Cancel) throw ex; } } else { this.OnExecuting(); this.ExecuteCore(); this.OnExecuted(new CommandExecutedArgs(this.Parameter)); } }