Records changes made to an object model and allows you to undo and redo them.
Implements
Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model.dll
Syntax
[Obsolete("[Recordable] aspect and its components are deprecated and will be removed in a future version.", false)]
public sealed class Recorder : INotifyPropertyChangedRemarks
An application typically uses a single recorder, exposed by the DefaultRecorder property, but you can create several, for instance one per document.
The UndoOperations and RedoOperations collections hold strong references to the objects whose changes they contain, which prevents these objects from being garbage collected. Use the MaximumOperationsCount property to limit the number of operations.
Do not modify objects that share a recorder concurrently from several threads.
Constructors
| Name | Description |
|---|---|
| Recorder() | Initializes a new instance of the Recorder class. |
| Recorder(object) | Initializes a new instance of the Recorder class and attaches it to a given object. |
Properties
| Name | Description |
|---|---|
| CanAddRestorePoint | Gets a value indicating whether the AddRestorePoint(string) method can be invoked. |
| CanRedo | Gets a value indicating whether the Redo() method can be invoked. |
| CanUndo | Gets a value indicating whether the Undo() method can be invoked. |
| MaximumOperationsCount | Gets or sets the maximum number of operations in the UndoOperations and RedoOperations collections. These collections are automatically trimmed so that their size never exceeds MaximumOperationsCount. |
| RedoOperations | Gets the collection of operations that can be redone using the Redo() method. |
| UndoOperations | Gets the collection of operations that can be undone using the Undo() method. |
Methods
| Name | Description |
|---|---|
| AddOperation(Operation) | Adds a new Operation to the UndoOperations collection of the current Recorder. |
| AddRestorePoint(string) | Adds a new restore point with the given name. |
| Attach(object) | Attaches a recordable object (including its descendant objects) to the current Recorder so that changes in this object start being recorded into the current Recorder. |
| Clear() | Clears the undo and redo lists. |
| Detach(object) | Detaches a recordable object from the current Recorder, so that changes in this object stop being recorded into the current Recorder. |
| OpenScope(RecordingScopeOption) | Opens an unnamed RecordingScope. |
| OpenScope(string, RecordingScopeOption) | Opens a RecordingScope with a given name. |
| Redo() | Redoes the last operation. |
| RedoTo(Operation) | Redoes all operations up to the specified operation. |
| Undo() | Undoes the last operation. |
| UndoTo(Operation) | Undoes all operations up to the specified Operation or RestorePoint. |
Events
| Name | Description |
|---|---|
| ChildPropertyChanged | Occurs after the property of a child object has been changed. |
| ChildPropertyChanging | Occurs before the property of a child object is changed. |
| PropertyChanged | Occurs when the value of a property of the current object changes. |