/// <summary> /// Performs the 'Undo' action of the most recently added command to the system. /// This command will then be moved to the redo stack so that it can later be redone /// if the command supports it. /// </summary> public void UndoCommand() { if (mUndoStack.Count == 0) { throw new InvalidOperationException("There are no commands to be undone"); } IVEFCommand cmd = mUndoStack.Pop(); cmd.Undo(); mRedoStack.Push(cmd); FireStateChanged(); }
/// <summary> /// Undoes the top most command on the undo stack and removes it from the system. The command /// does not transfer to the redo stack. /// </summary> public void UndoAndPopCommand() { if (mUndoStack.Count == 0) { throw new InvalidOperationException("There are no commands to be undone"); } IVEFCommand cmd = mUndoStack.Pop(); cmd.Undo(); cmd.Dispose(); // NOTE: We do not push the command onto the redo stack. It just vanishes FireStateChanged(); }