Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
SiliconStudio.ActionStack.TransactionalActionStack Class Reference

This class is an implementation of the ITransactionalActionStack interface. More...

Inheritance diagram for SiliconStudio.ActionStack.TransactionalActionStack:
SiliconStudio.ActionStack.ActionStack SiliconStudio.ActionStack.ITransactionalActionStack SiliconStudio.ActionStack.IActionStack SiliconStudio.ActionStack.IActionStack SiliconStudio.Presentation.ViewModel.ActionStack.ViewModelTransactionalActionStack

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.
Parameters
nameThe name given to the transaction at the end.
Returns
An EndTransaction subscription.
See also
BeginTransaction, EndTransaction(string)
More...
 
IDisposable BeginEndTransaction (Func< string > getName)
 Creates a BeginTransaction-EndTransaction subscription. Use it with a using statement to ensure balanced state integrity.
Parameters
getNameA delegate that late-evaluate the name given to the transaction at the end.
Returns
Returns a end transaction subscription.
See also
BeginTransaction, EndTransaction(string)
More...
 
IDisposable BeginCancelTransaction ()
 Creates a BeginTransaction-CancelTransaction transaction subscription. Use it with a using statement to ensure balanced state integrity.
Returns
Returns a cancel transaction subscription.
See also
BeginTransaction, CancelTransaction
More...
 
IDisposable BeginDiscardTransaction ()
 Creates a BeginTransaction-DiscardTransaction transaction subscription. Use it with a using statement to ensure balanced state integrity.
Returns
Returns a discard transaction subscription.
See also
BeginTransaction, DiscardTransaction
More...
 
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.
Parameters
displayName
Once the transaction is ended, an aggregate action is created with all action items that were added during the transaction. This aggregate is added to the action stack. More...
 
virtual void EndTransaction (string name, Func< IReadOnlyCollection< IActionItem >, IActionItem > aggregateActionItems)
 Ends a transaction started with BeginTransaction.
Parameters
displayName
aggregateActionItemsA function that will aggregate an enumeration of action items into a single action item.
Once the transaction is ended, an aggregate action is created with all action items that were added during the transaction. This aggregate is added to the action stack. More...
 
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< IActionItemGetCurrentTransactions ()
 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.
Parameters
itemThe action item to add to the stack.
More...
 
- Public Member Functions inherited from SiliconStudio.ActionStack.ActionStack
 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.
Parameters
itemsThe action items to add on the stack.
More...
 
void Clear ()
 Clears the action stack. More...
 
virtual SavePoint CreateSavePoint (bool markActionsAsSaved)
 Creates a save point at the current index of the action stack.
Parameters
markActionsAsSavedIndicate whether to set the IActionItem.IsSaved of all preceding action items to true.
Returns
A SavePoint object corresponding to the created save point.
More...
 
virtual bool Undo ()
 Undoes the last action item that is currently done.
Returns
True if an action could be undone, False otherwise.
More...
 
virtual bool Redo ()
 Redoes the first action item that is currently undone.
Returns
True if an action could be redone, False otherwise.
More...
 

Protected Attributes

readonly Stack< List
< IActionItem > > 
TransactionStack = new Stack<List<IActionItem>>()
 The stack of transactions currently in progress. More...
 

Additional Inherited Members

- Protected Member Functions inherited from SiliconStudio.ActionStack.ActionStack
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...
 
- Properties inherited from SiliconStudio.ActionStack.ActionStack
IEnumerable< IActionItemActionItems [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...
 
- Properties inherited from SiliconStudio.ActionStack.IActionStack
IEnumerable< IActionItemActionItems [get]
 Gets the action items currently stored in the action stack, including undone items that have not been disbranched. More...
 
- Events inherited from SiliconStudio.ActionStack.ActionStack
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...
 
- Events inherited from SiliconStudio.ActionStack.IActionStack
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...
 

Detailed Description

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.

Constructor & Destructor Documentation

SiliconStudio.ActionStack.TransactionalActionStack.TransactionalActionStack ( int  capacity)

Initializes a new instance of the TransactionalActionStack class with the given capacity.

Parameters
capacityThe 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.

Parameters
capacityThe stack capacity. If negative, the action stack will have an unlimited capacity.
initialActionsItemsThe action items to add to the stack.

Definition at line 40 of file TransactionalActionStack.cs.

Member Function Documentation

override void SiliconStudio.ActionStack.TransactionalActionStack.Add ( IActionItem  item)
virtual

Adds an action item to the stack. Discards any action item that is currently undone.

Parameters
itemThe 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.

Returns
Returns a cancel transaction subscription.
See also
BeginTransaction, CancelTransaction

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.

Returns
Returns a discard transaction subscription.
See also
BeginTransaction, DiscardTransaction

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.

Parameters
nameThe name given to the transaction at the end.
Returns
An EndTransaction subscription.
See also
BeginTransaction, EndTransaction(string)

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.

Parameters
getNameA delegate that late-evaluate the name given to the transaction at the end.
Returns
Returns a end transaction subscription.
See also
BeginTransaction, EndTransaction(string)

Implements SiliconStudio.ActionStack.ITransactionalActionStack.

Definition at line 53 of file TransactionalActionStack.cs.

virtual void SiliconStudio.ActionStack.TransactionalActionStack.BeginTransaction ( )
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 void SiliconStudio.ActionStack.TransactionalActionStack.CancelTransaction ( )
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 void SiliconStudio.ActionStack.TransactionalActionStack.DiscardTransaction ( )
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.

Parameters
displayName
Once the transaction is ended, an aggregate action is created with all action items that were added during the transaction. This aggregate is added to the action stack.

Implements SiliconStudio.ActionStack.ITransactionalActionStack.

Definition at line 94 of file TransactionalActionStack.cs.

virtual void SiliconStudio.ActionStack.TransactionalActionStack.EndTransaction ( string  name,
Func< IReadOnlyCollection< IActionItem >, IActionItem aggregateActionItems 
)
virtual

Ends a transaction started with BeginTransaction.

Parameters
displayName
aggregateActionItemsA function that will aggregate an enumeration of action items into a single action item.
Once the transaction is ended, an aggregate action is created with all action items that were added during the transaction. This aggregate is added to the action stack.

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.

Returns
The action items in the current transaction.

Definition at line 131 of file TransactionalActionStack.cs.

Member Data Documentation

readonly Stack<List<IActionItem> > SiliconStudio.ActionStack.TransactionalActionStack.TransactionStack = new Stack<List<IActionItem>>()
protected

The stack of transactions currently in progress.

Definition at line 24 of file TransactionalActionStack.cs.


The documentation for this class was generated from the following file: