protected virtual void OnBeforeExecute(BeforeExecuteEventArgs e) { if(BeforeExecute != null) BeforeExecute(this, e); }
public void Execute(ICommand command) { BeforeExecuteEventArgs args = new BeforeExecuteEventArgs() { Cancel = false, Command = command }; OnBeforeExecute(args); if(!args.Cancel) { command.Execute(); if(command is IUndoableCommand) { commandHistory.Push((IUndoableCommand)command); undoneCommands.Clear(); OnCommandHistoryChanged(); } } }