C# Class Memento.Mementor

Provides undo and redo services.
Inheritance: IDisposable
Afficher le fichier Open project: buunguyen/memento Class Usage Examples

Méthodes publiques

Méthode Description
Batch ( System.Action codeBlock ) : void

Marks a batch during which all events are combined so that Undo only needs calling once.

Batches cannot be nested. At any point, there must be only one active batch.

BeginBatch ( ) : void

Explicitly marks the beginning of a batch. Use this instead of Batch changes can be made in different places instead of inside one certain block of code. When finish, end the batch by invoking EndBatch.

Dispose ( ) : void

Disposes the this mementor and clears redo and undo stacks. This method won't fire Changed event.

EndBatch ( ) : void

Ends a batch.

ExecuteNoTrack ( System.Action codeBlock ) : void

Executes the supplied code block with IsTrackingEnabled turned off.

MarkEvent ( BaseEvent anEvent ) : void

Marks an event. This method also serves as an extensibility point for custom events.

Mementor ( bool isEnabled = true ) : System

Creates an instance of Mementor.

Redo ( ) : void

Performs a redo.

Reset ( ) : void

Resets the state of this Mementor object to its initial state. This effectively clears the redo stack, undo stack and current batch (if one is active).

Undo ( ) : void

Performs an undo.

Private Methods

Méthode Description
InternalEndBatch ( BatchEvent stack ) : BaseEvent
NotifyChange ( BaseEvent @event ) : void
PerformPostMarkAction ( BaseEvent @event ) : void
ProcessBatch ( BatchEvent batchEvent ) : BaseEvent
RollbackEvent ( BaseEvent @event, bool undoing ) : void

Method Details

Batch() public méthode

Marks a batch during which all events are combined so that Undo only needs calling once.
Batches cannot be nested. At any point, there must be only one active batch.
public Batch ( System.Action codeBlock ) : void
codeBlock System.Action The code block performing batch change marking.
Résultat void

BeginBatch() public méthode

Explicitly marks the beginning of a batch. Use this instead of Batch changes can be made in different places instead of inside one certain block of code. When finish, end the batch by invoking EndBatch.
public BeginBatch ( ) : void
Résultat void

Dispose() public méthode

Disposes the this mementor and clears redo and undo stacks. This method won't fire Changed event.
public Dispose ( ) : void
Résultat void

EndBatch() public méthode

Ends a batch.
public EndBatch ( ) : void
Résultat void

ExecuteNoTrack() public méthode

Executes the supplied code block with IsTrackingEnabled turned off.
public ExecuteNoTrack ( System.Action codeBlock ) : void
codeBlock System.Action The code block to be executed.
Résultat void

MarkEvent() public méthode

Marks an event. This method also serves as an extensibility point for custom events.
public MarkEvent ( BaseEvent anEvent ) : void
anEvent BaseEvent The event to be marked.
Résultat void

Mementor() public méthode

Creates an instance of Mementor.
public Mementor ( bool isEnabled = true ) : System
isEnabled bool Whether this instance is enabled or not.
Résultat System

Redo() public méthode

Performs a redo.
public Redo ( ) : void
Résultat void

Reset() public méthode

Resets the state of this Mementor object to its initial state. This effectively clears the redo stack, undo stack and current batch (if one is active).
public Reset ( ) : void
Résultat void

Undo() public méthode

Performs an undo.
public Undo ( ) : void
Résultat void