Meziantou.Framework.UndoRedo namespace

Classes

NameDescription
UndoRedoActionBaseBase class for IUndoRedoAction implementations. It tracks whether the action is currently applied so it cannot be executed or reverted twice in a row, and delegates the actual work to UndoRedoActionBase.ExecuteCoreAsync and UndoRedoActionBase.UnExecuteCoreAsync.
UndoRedoDelegateActionAn IUndoRedoAction defined by a pair of delegates, so an action can be recorded without writing a dedicated subclass. The execute and unexecute delegates can each be synchronous (Action) or asynchronous (Func<T, TResult> returning a ValueTask), and the two may be mixed (e.g. an async execute with a sync unexecute).
UndoRedoManagerRecords actions and provides asynchronous undo/redo capabilities. Actions can be grouped into transactions and consecutive actions can be merged into a single undo step.
UndoRedoNotificationExceptionThrown when a UndoRedoManager.HistoryChanged handler fails. The operation that raised the notification (recording, undoing, redoing or clearing) has already completed successfully, so the caller must not retry it; only the notification failed.
UndoRedoTransactionGroups several actions into a single undoable/redoable unit. Create one with UndoRedoManager.CreateTransaction and commit it to record it as a single step. Committing is all-or-nothing: if one of the actions fails, the actions that already ran are reverted before the exception is propagated.

Interfaces

NameDescription
IUndoRedoActionRepresents a single undoable/redoable action. Implementations encapsulate both how to apply a change (IUndoRedoAction.ExecuteAsync) and how to revert it (IUndoRedoAction.UnExecuteAsync).

Enums

NameDescription
TransactionExecutionModeDetermines when the actions recorded in an UndoRedoTransaction are executed.