public void Undo(int numberOfUndos = 1) { for (int i = 0; i < numberOfUndos; i++) { var command = stack.Undo(); if (command == null) { throw new ApplicationException(); } command.Undo(); RaiseOperationExecuted(command, ExecutionOperation.Undo); } }
public void Undo(int numberOfUndos = 1) { for (int i = 0; i < numberOfUndos; i++) { var command = stack.Undo(); if (command == null) { throw new ApplicationException(); } command.Undo(); RaiseOperationExecuted(command, CommandOperation.Undo); if (command.isImplicit) { i--; // Do not increase undo counter if command is implicit } } }