Class CommandHistory
Manages command history for undo/redo functionality. Uses a bounded deque structure for O(1) trimming operations.
public class CommandHistory
- Inheritance
-
CommandHistory
- Inherited Members
Constructors
CommandHistory(int)
Creates a new command history with the specified maximum size.
public CommandHistory(int maxHistorySize = 100)
Parameters
maxHistorySizeintMaximum number of commands to keep in history. 0 = unlimited.
Properties
CanRedo
Gets whether there are commands that can be redone.
public bool CanRedo { get; }
Property Value
CanUndo
Gets whether there are commands that can be undone.
public bool CanUndo { get; }
Property Value
NextRedoDescription
Gets the description of the next command to redo, or null if none.
public string? NextRedoDescription { get; }
Property Value
NextUndoDescription
Gets the description of the next command to undo, or null if none.
public string? NextUndoDescription { get; }
Property Value
RedoCount
Gets the number of commands in the redo stack.
public int RedoCount { get; }
Property Value
UndoCount
Gets the number of commands in the undo stack.
public int UndoCount { get; }
Property Value
Methods
Clear()
Clears all command history.
public void Clear()
Execute(IGraphCommand)
Executes a command and adds it to the history.
public void Execute(IGraphCommand command)
Parameters
commandIGraphCommand
Redo()
Redoes the last undone command.
public bool Redo()
Returns
- bool
True if a command was redone, false if there was nothing to redo.
Undo()
Undoes the last command.
public bool Undo()
Returns
- bool
True if a command was undone, false if there was nothing to undo.
Events
HistoryChanged
Event raised when the undo/redo state changes.
public event EventHandler? HistoryChanged