/// <summary> /// Starts new multi-action undo/redo step. /// </summary> /// <param name="name">Name of undo/redo step.</param> /// <returns>Temporary disposable object to dispose when step is finished.</returns> public IDisposable BeginMultiActionsUndoRedoStep(string name) { Debug.Assert(CurrentStep == null, "It is not possible to begin new undo-redo step until finish current."); CurrentStep = new UndoRedoStep(name); return(new DisposableAction( () => { AddUndoStep(CurrentStep); CurrentStep = null; })); }
/// <summary> /// Adds redo step to redo stack. /// </summary> /// <param name="step">Redo step to add.</param> protected void AddRedoStep(UndoRedoStep step) { redoSteps.Push(step); OnStateChanged(); }