Table of Contents

Class CommandHistory

Namespace
FlowGraph.Core.Commands
Assembly
FlowGraph.Core.dll

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

maxHistorySize int

Maximum 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

bool

CanUndo

Gets whether there are commands that can be undone.

public bool CanUndo { get; }

Property Value

bool

NextRedoDescription

Gets the description of the next command to redo, or null if none.

public string? NextRedoDescription { get; }

Property Value

string

NextUndoDescription

Gets the description of the next command to undo, or null if none.

public string? NextUndoDescription { get; }

Property Value

string

RedoCount

Gets the number of commands in the redo stack.

public int RedoCount { get; }

Property Value

int

UndoCount

Gets the number of commands in the undo stack.

public int UndoCount { get; }

Property Value

int

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

command IGraphCommand

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

Event Type

EventHandler