C# Класс Memento.Mementor

Provides undo and redo services.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
InternalEndBatch ( BatchEvent stack ) : BaseEvent
NotifyChange ( BaseEvent @event ) : void
PerformPostMarkAction ( BaseEvent @event ) : void
ProcessBatch ( BatchEvent batchEvent ) : BaseEvent
RollbackEvent ( BaseEvent @event, bool undoing ) : void

Описание методов

Batch() публичный Метод

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.
Результат void

BeginBatch() публичный Метод

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
Результат void

Dispose() публичный Метод

Disposes the this mementor and clears redo and undo stacks. This method won't fire Changed event.
public Dispose ( ) : void
Результат void

EndBatch() публичный Метод

Ends a batch.
public EndBatch ( ) : void
Результат void

ExecuteNoTrack() публичный Метод

Executes the supplied code block with IsTrackingEnabled turned off.
public ExecuteNoTrack ( System.Action codeBlock ) : void
codeBlock System.Action The code block to be executed.
Результат void

MarkEvent() публичный Метод

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.
Результат void

Mementor() публичный Метод

Creates an instance of Mementor.
public Mementor ( bool isEnabled = true ) : System
isEnabled bool Whether this instance is enabled or not.
Результат System

Redo() публичный Метод

Performs a redo.
public Redo ( ) : void
Результат void

Reset() публичный Метод

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
Результат void

Undo() публичный Метод

Performs an undo.
public Undo ( ) : void
Результат void