Table of Contents

Class CommandExecutor

Namespace
Bonsai.Design
Assembly
Bonsai.Design.dll

Represents a command execution stack with support for undo and redo operations.

public class CommandExecutor : Component, IComponent, IDisposable
Inheritance
CommandExecutor
Implements
Inherited Members

Properties

CanRedo

Gets a value indicating whether there are any commands available to redo on the command execution stack.

public bool CanRedo { get; }

Property Value

bool

CanUndo

Gets a value indicating whether there are any commands available to undo on the command execution stack.

public bool CanUndo { get; }

Property Value

bool

Methods

BeginCompositeCommand()

Marks the beginning of a composite command execution.

public void BeginCompositeCommand()

Remarks

Every command executed until EndCompositeCommand() will be considered part of the composite action. Calling undo or redo on a composite action will affect all commands in the composite, as if they were effectively part of a single command.

Clear()

Clears the entire command execution history.

public void Clear()

EndCompositeCommand()

Marks the end of a composite command execution.

public void EndCompositeCommand()

Execute(Action, Action)

Specifies a new action for immediate execution, together with the optional undo action which reverses the effects of the command.

public void Execute(Action command, Action undo)

Parameters

command Action

The command to execute.

undo Action

The undo action which reverses the effects of the command. If no undo action is specified, the entire command history up to the execution of this command will be cleared.

OnStatusChanged(EventArgs)

Raises the StatusChanged event.

protected virtual void OnStatusChanged(EventArgs e)

Parameters

e EventArgs

An EventArgs that contains the event data.

Redo()

Redo the effects of the command which was previously undone.

public void Redo()

Undo()

Undo the effects of the previously executed command.

public void Undo()

Undo(bool)

Undo the effects of the previously executed command, with optional support for redo operations.

public void Undo(bool allowRedo)

Parameters

allowRedo bool

If this parameter is true, redo operations will be allowed after undoing the previous command. Otherwise, all the forward history, including the command being undone will be cleared.

Events

StatusChanged

Occurs when the command execution stack has changed, either by executing a new command, or calling undo or redo operations.

public event EventHandler StatusChanged

Event Type

EventHandler