private void Execute(CommandExecutionConfiguration config) { config.ExecutingCommand.EventAggregator = EventAggregator; var abstractCommand = config.ExecutingCommand as AbstractCommand; if (abstractCommand != null) { abstractCommand.CommandManager = this; abstractCommand.SynchronizationContext = this.syncContext; } if (config.Callback != null) { config.ExecutingCommand.CompletedHandler = config.Callback; } // choose wether to record the command or just fire it. if (config.RecordCommandWithHistoryForUndoRedo) { RecordCommand(config.ExecutingCommand as AbstractCommand); } else if (config.ExecutingCommand.CanExecute()) { if (config.RunInBackground) { this.ExecuteInSpawnedThread(config.ExecutingCommand as AbstractCommand); } else { config.ExecutingCommand.Execute(); } } }
public static CommandExecutionConfiguration The(ICommand command) { var config = new CommandExecutionConfiguration { ExecutingCommand = command }; if (command is AbstractCommand) { (command as AbstractCommand).ExecutionConfiguration = config; } return config; }
public static CommandExecutionConfiguration The(ICommand command) { var config = new CommandExecutionConfiguration { ExecutingCommand = command }; if (command is AbstractCommand) { (command as AbstractCommand).ExecutionConfiguration = config; } return(config); }
public void Do(CommandExecutionConfiguration configuration) { RunCommandTillEndWith(() => { RedoStack.Clear(); Execute(configuration); if (autocommit) { this.CommitTransaction(); } RaiseCanUndoRedoChanged(this, EventArgs.Empty); }); }