Table of Contents

Class UndoableAction

Namespace
TinyLife.Tools
Assembly
Tiny Life.dll

An undoable action is an action used by a UndoRedoStack. Optionally, using the UndoableAction(bool) constructor, an undoable action can be set to be executed immediately, rather than being able to be undone and redone.

public class UndoableAction
Inheritance
UndoableAction
Inherited Members
Extension Methods

Constructors

UndoableAction(bool)

Creates a new undoable action.

public UndoableAction(bool immediate = false)

Parameters

immediate bool

Determines whether this undoable action should be executed immediately, or if the action added to it should be executed as part of an UndoRedoStack.

Methods

Add(Action, Action)

Adds the given sub-action and undo action to this undoable action. Note that undo actions are executed in reverse order that they are added to maintain proper ordering.

public void Add(Action action, Action undo)

Parameters

action Action

The action to add.

undo Action

The action that undoes the added action.

AddBothAfter(Action)

Adds the given sub-action to this undoable action in a way that causes it to be executed after the action is done, undone, or redone. Actions added this way are usually validation steps, like marking an object dirty.

public void AddBothAfter(Action after)

Parameters

after Action

The action to add.

ExecuteAction()

Executes this undoable action, executing every action added using Add(Action, Action) and AddBothAfter(Action).

public void ExecuteAction()

ExecuteUndo()

Undoes this undoable action, executing every undone action added using Add(Action, Action) and every action added using AddBothAfter(Action).

public void ExecuteUndo()