/// <summary> /// Undoes the commands until the target to undo (from the last action). /// </summary> /// <param name="targetToUndo">The target to undo.</param> public void UndoCommandsUntil(CommandGeneric targetToUndo) { foreach (var com in CommandHistory.Reverse()) { if(com.Done) com.Undo(); if (com == targetToUndo) { break; } } }
public void RedoCommandsUntil(CommandGeneric targetToRedo) { foreach (var com in CommandHistory) { if(!com.Done) com.Redo(); if (com == targetToRedo) { break; } } }