/// <summary> /// The redo. /// </summary> /// <param name="levels"> /// The levels. /// </param> public void Redo(int levels) { Console.WriteLine("\n---- Redo {0} levels ", levels); // Perform redo operations for (int i = 0; i < levels; i++) { if (this.Current < this.Commands.Count - 1) { AnAbstractCommand command = this.Commands[this.Current++]; command.Execute(); } } }
/// <summary> /// The undo. /// </summary> /// <param name="levels"> /// The levels. /// </param> public void Undo(int levels) { Console.WriteLine("\n---- Undo {0} levels ", levels); // Perform undo operations for (int i = 0; i < levels; i++) { if (this.Current > 0) { AnAbstractCommand command = this.Commands[--this.Current] as AnAbstractCommand; command.UnExecute(); } } }