![]() |
Paradox Game Engine
v1.0.0 beta06
|
This class is an implementation of the ITransactionalActionStack interface. More...
Public Member Functions | |||||
TransactionalActionStack (int capacity) | |||||
Initializes a new instance of the TransactionalActionStack class with the given capacity. More... | |||||
TransactionalActionStack (int capacity, IEnumerable< IActionItem > initialActionsItems) | |||||
Initializes a new instance of the TransactionalActionStack class with the given capacity and existing action items. More... | |||||
IDisposable | BeginEndTransaction (string name) | ||||
Creates a BeginTransaction-EndTransaction subscription. Use it with a using statement to ensure balanced state integrity.
| |||||
IDisposable | BeginEndTransaction (Func< string > getName) | ||||
Creates a BeginTransaction-EndTransaction subscription. Use it with a using statement to ensure balanced state integrity.
| |||||
IDisposable | BeginCancelTransaction () | ||||
Creates a BeginTransaction-CancelTransaction transaction subscription. Use it with a using statement to ensure balanced state integrity.
| |||||
IDisposable | BeginDiscardTransaction () | ||||
Creates a BeginTransaction-DiscardTransaction transaction subscription. Use it with a using statement to ensure balanced state integrity.
| |||||
virtual void | BeginTransaction () | ||||
Begins a transaction. IActionItem added after a call to BeginTransaction are stored in a temporary transaction stack, until a call to EndTransaction(string), CancelTransaction, or DiscardTransaction is done. More... | |||||
void | EndTransaction (string name) | ||||
Ends a transaction started with BeginTransaction.
| |||||
virtual void | EndTransaction (string name, Func< IReadOnlyCollection< IActionItem >, IActionItem > aggregateActionItems) | ||||
Ends a transaction started with BeginTransaction.
| |||||
virtual void | CancelTransaction () | ||||
Cancels a transaction started with BeginTransaction. Every action from the cancelled transaction will be undone. This method will undo every action item of the transaction and then discard them. More... | |||||
virtual void | DiscardTransaction () | ||||
Discard a transaction started with BeginTransaction. This method will ends the transaction and discard every action item it contains. More... | |||||
IReadOnlyCollection< IActionItem > | GetCurrentTransactions () | ||||
Gets the action items in the current transaction. More... | |||||
override void | Add (IActionItem item) | ||||
Adds an action item to the stack. Discards any action item that is currently undone.
| |||||
![]() | |||||
ActionStack (int capacity) | |||||
Initializes a new instance of the ActionStack class with the given capacity. More... | |||||
ActionStack (int capacity, IEnumerable< IActionItem > initialActionsItems) | |||||
Initializes a new instance of the ActionStack class with the given capacity and existing action items. More... | |||||
void | AddRange (IEnumerable< IActionItem > items) | ||||
Adds multiple action items on the stack. Discards any action item that is currently undone.
| |||||
void | Clear () | ||||
Clears the action stack. More... | |||||
virtual SavePoint | CreateSavePoint (bool markActionsAsSaved) | ||||
Creates a save point at the current index of the action stack.
| |||||
virtual bool | Undo () | ||||
Undoes the last action item that is currently done.
| |||||
virtual bool | Redo () | ||||
Redoes the first action item that is currently undone.
| |||||
Protected Attributes | |
readonly Stack< List < IActionItem > > | TransactionStack = new Stack<List<IActionItem>>() |
The stack of transactions currently in progress. More... | |
Additional Inherited Members | |
![]() | |
virtual void | OnActionItemsDiscarded (DiscardedActionItemsEventArgs< IActionItem > e) |
Invoked whenever action items are discarded from the stack. More... | |
virtual void | OnActionItemsAdded (ActionItemsEventArgs< IActionItem > e) |
Invoked whenever action items are added to the stack. More... | |
virtual void | OnActionItemsCleared () |
Invoked whenever the action stack is cleared. More... | |
virtual void | OnUndone (ActionItemsEventArgs< IActionItem > e) |
Invoked Raised when an action item is undone. More... | |
virtual void | OnRedone (ActionItemsEventArgs< IActionItem > e) |
Invoked Raised when an action item is redone. More... | |
![]() | |
IEnumerable< IActionItem > | ActionItems [get] |
int | Capacity [get] |
Gets the capacity of this action stack. More... | |
bool | CanUndo [get] |
Gets whether an undo operation can be executed. More... | |
bool | CanRedo [get] |
Gets whether an redo operation can be executed. More... | |
int | CurrentIndex [get, set] |
Gets the index at which the next action item will be added. More... | |
bool | UndoRedoInProgress [get, set] |
Gets whether an undo/redo operation is currently in progress. More... | |
![]() | |
IEnumerable< IActionItem > | ActionItems [get] |
Gets the action items currently stored in the action stack, including undone items that have not been disbranched. More... | |
![]() | |
EventHandler < ActionItemsEventArgs < IActionItem > > | ActionItemsAdded |
Raised whenever action items are added to the stack. More... | |
EventHandler | ActionItemsCleared |
Raised whenever the action stack is cleared. More... | |
EventHandler < DiscardedActionItemsEventArgs < IActionItem > > | ActionItemsDiscarded |
Raised whenever action items are discarded from the stack. More... | |
EventHandler < ActionItemsEventArgs < IActionItem > > | Undone |
Raised when an action item is undone. More... | |
EventHandler < ActionItemsEventArgs < IActionItem > > | Redone |
Raised when an action item is redone. More... | |
![]() | |
EventHandler < ActionItemsEventArgs < IActionItem > > | ActionItemsAdded |
Raised whenever action items are added to the stack. More... | |
EventHandler | ActionItemsCleared |
Raised whenever the action stack is cleared. More... | |
EventHandler < DiscardedActionItemsEventArgs < IActionItem > > | ActionItemsDiscarded |
Raised whenever action items are discarded from the stack. More... | |
EventHandler < ActionItemsEventArgs < IActionItem > > | Undone |
Raised when an action item is undone. More... | |
EventHandler < ActionItemsEventArgs < IActionItem > > | Redone |
Raised when an action item is redone. More... | |
This class is an implementation of the ITransactionalActionStack interface.
A transactional action stack is an action stack that generates IAggregateActionItem from the action items that are added after a transaction is started and before it is finished. A transaction can also be cancelled (undone) or discarded instead of creating an aggregate action item. Multiple transactions can be created at the same time, each transaction that ends will become a single item of the parent transaction in progress.
Definition at line 19 of file TransactionalActionStack.cs.
SiliconStudio.ActionStack.TransactionalActionStack.TransactionalActionStack | ( | int | capacity | ) |
Initializes a new instance of the TransactionalActionStack class with the given capacity.
capacity | The stack capacity. If negative, the action stack will have an unlimited capacity. |
Definition at line 30 of file TransactionalActionStack.cs.
SiliconStudio.ActionStack.TransactionalActionStack.TransactionalActionStack | ( | int | capacity, |
IEnumerable< IActionItem > | initialActionsItems | ||
) |
Initializes a new instance of the TransactionalActionStack class with the given capacity and existing action items.
capacity | The stack capacity. If negative, the action stack will have an unlimited capacity. |
initialActionsItems | The action items to add to the stack. |
Definition at line 40 of file TransactionalActionStack.cs.
|
virtual |
Adds an action item to the stack. Discards any action item that is currently undone.
item | The action item to add to the stack. |
Reimplemented from SiliconStudio.ActionStack.ActionStack.
Reimplemented in SiliconStudio.Presentation.ViewModel.ActionStack.ViewModelTransactionalActionStack.
Definition at line 138 of file TransactionalActionStack.cs.
References SiliconStudio.ActionStack.UndoRedoInProgress.
IDisposable SiliconStudio.ActionStack.TransactionalActionStack.BeginCancelTransaction | ( | ) |
Creates a BeginTransaction-CancelTransaction transaction subscription. Use it with a using statement to ensure balanced state integrity.
Implements SiliconStudio.ActionStack.ITransactionalActionStack.
Definition at line 73 of file TransactionalActionStack.cs.
IDisposable SiliconStudio.ActionStack.TransactionalActionStack.BeginDiscardTransaction | ( | ) |
Creates a BeginTransaction-DiscardTransaction transaction subscription. Use it with a using statement to ensure balanced state integrity.
Implements SiliconStudio.ActionStack.ITransactionalActionStack.
Definition at line 80 of file TransactionalActionStack.cs.
IDisposable SiliconStudio.ActionStack.TransactionalActionStack.BeginEndTransaction | ( | string | name | ) |
Creates a BeginTransaction-EndTransaction subscription. Use it with a using statement to ensure balanced state integrity.
name | The name given to the transaction at the end. |
Implements SiliconStudio.ActionStack.ITransactionalActionStack.
Definition at line 46 of file TransactionalActionStack.cs.
IDisposable SiliconStudio.ActionStack.TransactionalActionStack.BeginEndTransaction | ( | Func< string > | getName | ) |
Creates a BeginTransaction-EndTransaction subscription. Use it with a using statement to ensure balanced state integrity.
getName | A delegate that late-evaluate the name given to the transaction at the end. |
Implements SiliconStudio.ActionStack.ITransactionalActionStack.
Definition at line 53 of file TransactionalActionStack.cs.
|
virtual |
Begins a transaction. IActionItem added after a call to BeginTransaction are stored in a temporary transaction stack, until a call to EndTransaction(string), CancelTransaction, or DiscardTransaction is done.
Implements SiliconStudio.ActionStack.ITransactionalActionStack.
Definition at line 87 of file TransactionalActionStack.cs.
|
virtual |
Cancels a transaction started with BeginTransaction. Every action from the cancelled transaction will be undone. This method will undo every action item of the transaction and then discard them.
Implements SiliconStudio.ActionStack.ITransactionalActionStack.
Definition at line 110 of file TransactionalActionStack.cs.
|
virtual |
Discard a transaction started with BeginTransaction. This method will ends the transaction and discard every action item it contains.
Implements SiliconStudio.ActionStack.ITransactionalActionStack.
Definition at line 121 of file TransactionalActionStack.cs.
void SiliconStudio.ActionStack.TransactionalActionStack.EndTransaction | ( | string | name | ) |
Ends a transaction started with BeginTransaction.
displayName |
Implements SiliconStudio.ActionStack.ITransactionalActionStack.
Definition at line 94 of file TransactionalActionStack.cs.
|
virtual |
Ends a transaction started with BeginTransaction.
displayName | |
aggregateActionItems | A function that will aggregate an enumeration of action items into a single action item. |
Implements SiliconStudio.ActionStack.ITransactionalActionStack.
Definition at line 100 of file TransactionalActionStack.cs.
IReadOnlyCollection<IActionItem> SiliconStudio.ActionStack.TransactionalActionStack.GetCurrentTransactions | ( | ) |
Gets the action items in the current transaction.
Definition at line 131 of file TransactionalActionStack.cs.
|
protected |
The stack of transactions currently in progress.
Definition at line 24 of file TransactionalActionStack.cs.