public void Undo(int levels) { Console.WriteLine("\n---- Undo {0} levels ", levels); // Perform undo operations for (int i = 0; i < levels; i++) { if (_current > 0) { CommandEx command = _commands[--_current] as CommandEx; command.UnExecute(); } } }
public void Redo(int levels) { Console.WriteLine("\n---- Redo {0} levels ", levels); // Perform redo operations for (int i = 0; i < levels; i++) { if (_current < _commands.Count - 1) { CommandEx command = _commands[_current++]; command.Execute(); } } }