public void Execute(IUndoableCommand command) { command.Execute(); _undoStack.Push(command); _redoStack.Clear(); OnCommandExecuted(); }
public void ExecuteCommand(IUndoableCommand cmd) { if (cmd == null) { return; } cmd.Execute(); _undoStack.Push(cmd); }
public bool ExecuteCommand(IUndoableCommand command) { // Any execution removes all previous undoCommands for redo functionality. if (undoneCommands.Any()) { undoneCommands.Clear(); } commands.Push(command); return(command.Execute()); }
public void Execute(IUndoableCommand command) { if (!AssertEdit(command)) { return; } command.Execute(); InvokeLDNetworksChangedEvent(command); IsModify = true; if (command is ElementReplaceArgumentCommand && !((ElementReplaceArgumentCommand)command).CanUndo) { return; } UndoStack.Push(command); RedoStack.Clear(); }
public void ExecuteCommand(IUndoableCommand command) { if (command == null) { return; } //if undo stack pointer is before the last index of the list, there have been undo actions made if (_undoStackPointer < _undoStack.Count) { //overwrite remaining undo stack _undoStack = _undoStack.GetRange(0, _undoStackPointer); //<-- undo stack becomes the first N actions, where N is the pointer value (convenient!) } command.Execute(); Game.Log(Logging.Category.SONG_DATA, $"Editor command executed: {command.Description}.", Logging.Level.LOG); _undoStack.Add(command); _undoStackPointer++; }
public bool Execute() { if (!IswaitToExecute) { return(false); } if (commandIndex >= commands.Count) { return(false); } IswaitToExecute = false; icommand = commands[commandIndex]; lastCommand = icommand; if (icommand != null) { icommand.Execute(); undoFunctions.Push(icommand.UnDo); commandIndex++; } return(true); }
public void Execute(IUndoableCommand c) { c.Execute(); this.commands.Push(c); }
public void TurnSwitchOff() { _offCommand.Execute(); }
public void TurnSwitchOn() { _onCommand.Execute(); }