Class UndoableAction
An undoable action is an action used by a UndoRedoStack. Optionally, using the UndoableAction(Boolean) constructor, an undoable action can be set to be executed immediately, rather than being able to be undone and redone.
Inheritance
Inherited Members
Namespace: TinyLife.Tools
Assembly: Tiny Life.dll
Syntax
public class UndoableAction
Constructors
UndoableAction(Boolean)
Creates a new undoable action.
Declaration
public UndoableAction(bool immediate = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | immediate | 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.
Declaration
public void Add(Action action, Action undo)
Parameters
Type | Name | Description |
---|---|---|
System.Action | action | The action to add. |
System.Action | undo | The action that undoes the added |
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.
Declaration
public void AddBothAfter(Action after)
Parameters
Type | Name | Description |
---|---|---|
System.Action | after | The action to add. |
ExecuteAction()
Executes this undoable action, executing every action added using Add(Action, Action) and AddBothAfter(Action).
Declaration
public void ExecuteAction()
ExecuteUndo()
Undoes this undoable action, executing every undone action added using Add(Action, Action) and every action added using AddBothAfter(Action).
Declaration
public void ExecuteUndo()