Пример #1
0
        public void Execute(IUndoableCommand command)
        {
            command.Execute();
            _undoStack.Push(command);
            _redoStack.Clear();

            OnCommandExecuted();
        }
Пример #2
0
        public void ExecuteCommand(IUndoableCommand cmd)
        {
            if (cmd == null)
            {
                return;
            }

            cmd.Execute();
            _undoStack.Push(cmd);
        }
Пример #3
0
        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());
        }
Пример #4
0
 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();
 }
Пример #5
0
        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);
    }
Пример #7
0
 public void Execute(IUndoableCommand c)
 {
     c.Execute();
     this.commands.Push(c);
 }
Пример #8
0
 public void TurnSwitchOff()
 {
     _offCommand.Execute();
 }
Пример #9
0
 public void TurnSwitchOn()
 {
     _onCommand.Execute();
 }