Exemple #1
0
        public void Undo(int level)
        {
            Console.WriteLine("\n---- Undo {0} levels ", level);

            // Perform undo operations
            for (int i = 0; i < level; i++)
            {
                if (_currentLevel > 0)
                {
                    Behavioral.Command.AbstractCommand.Command command = _commandsRepository[--_currentLevel] as Behavioral.Command.AbstractCommand.Command;
                    command.UnExecute();
                }
            }
        }
Exemple #2
0
        public void Redo(int level)
        {
            Console.WriteLine("\n---- Redo {0} levels ", level);

            // Perform redo operations
            for (int i = 0; i < level; i++)
            {
                if (_currentLevel < _commandsRepository.Count - 1)
                {
                    Behavioral.Command.AbstractCommand.Command command = _commandsRepository[_currentLevel++];
                    command.Execute();
                }
            }
        }