UndoList<T>

public class UndoList<T>
Provides an undo/redo list mechanism.
TType constraint.

Constructors

UndoList

#
Create a new undo/redo list.
public UndoList(
T
initial
Initial current state.
)

Properties

CanRedo

#
Gets whether a redo operation is possible.
public bool CanRedo { get; }

CanUndo

#
Gets whether an undo operation is possible.
public bool CanUndo { get; }

Current

#
Gets or sets the current state. When set, the redo list will be cleared and the current "current" state will be pushing onto the undo stack.
public T Current { get; set; }

RedoCount

#
Gets the number of redo records.
public int RedoCount { get; }

RedoRecords

#
Enumerates over all redo records, starting with the most recent one.
public IEnumerable<T> RedoRecords { get; }

UndoCount

#
Gets the number of undo records.
public int UndoCount { get; }

UndoRecords

#
Enumerates over all undo records, starting with the most recent one.
public IEnumerable<T> UndoRecords { get; }

Methods

Clear

#
Erase all undo and redo records.
public void Clear()

Clear

#
Erase undo and/or redo records. Only call this overload if you know what you are doing. Typically you always want to clear *both* buffers at the same time.
public void Clear(
clearUndo,
If true, the undo buffer will be erased.
clearRedo
If true, the redo buffer will be erased.
)

FirstRedoRecord

#
Gets the first redo record, if any.
public bool FirstRedoRecord(
out T
record
First record.
)
True if there was a record.

FirstUndoRecord

#
Gets the first undo record, if any.
public bool FirstUndoRecord(
out T
record
First record.
)
True if there was a record.

PerformRedo

#
Perform a single redo step. This will move a the current state onto the undo stack and pop the most recent redo record into the current state.
public bool PerformRedo()
Redo record.

PerformUndo

#
Perform a single undo step. This will move the current state onto the redo stack and pop the most recent undo record into the current state.
public bool PerformUndo()
True if an undo was performed.

SetCurrentQuietly

#
Set the current state without affecting the undo and redo stacks. Use this method if you wish to update the current state without recording an undo record.
public void SetCurrentQuietly(
T
state
)