/// <summary> /// /// </summary> public void RunCommand() { while (CommandQueue.Count > 0) { ICommand command = CommandQueue.Dequeue(); command.Apply(); } }
public static bool ApplyCommand(this Entity entity, ICommand command) { if (command.CheckConstraints(entity)) { command.Apply(entity); return(true); } return(false); }
public void ApplyCommand(ICommand <T> command) { command.Apply(_source); _commands.Push(command); if (_redoCommands.Count > 0) { _redoCommands.Clear(); } OnPropertyChanged(nameof(CanUndo)); OnPropertyChanged(nameof(CanRedo)); }
/// <summary> /// Применяет команду к текущему состоянию /// </summary> /// <param name="command">Команда</param> /// <returns>Успешность применения команды</returns> public bool ApplyCommand(ICommand command) { if (!command.Apply(state)) { return(false); } if (state.IsValid()) { return(true); } command.Revert(state); return(false); }
public void Execute(ICommand command) { command.Apply(); _commandHistory.Push(command); _commandFuture.Clear(); }