UndoEngine Class
Specifies generic undo/redo functionality at design time.
Assembly: System.Design (in System.Design.dll)
The UndoEngine type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | Enabled | Enables or disables the UndoEngine. |
![]() | UndoInProgress | Indicates if an undo action is in progress. |
| Name | Description | |
|---|---|---|
![]() | AddUndoUnit | Adds an UndoEngine::UndoUnit to the undo stack. |
![]() | CreateUndoUnit | Creates a new UndoEngine::UndoUnit. |
![]() | DiscardUndoUnit | Discards an UndoEngine::UndoUnit. |
![]() | Dispose() | Releases all resources used by the UndoEngine. |
![]() | Dispose(Boolean) | Releases the unmanaged resources used by the UndoEngine and optionally releases the managed resources. |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetRequiredService | Gets the requested service. |
![]() | GetService | Gets the requested service. |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | OnUndoing | Raises the Undoing event. |
![]() | OnUndone | Raises the Undone event. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
The UndoEngine abstract class provides a default implementation of undo functionality at design time. An undo unit represents a single unit of undoable work. This unit is added to a stack and the user can then walk the stack to undo each action. Undo units typically are designed to toggle, which means that calling undo twice returns the application to its starting state.
The UndoEngine class takes advantage of the following characteristics of objects running within the designer:
All interesting objects can be persisted to some format by the designer loader.
All objects raise property-change notifications when a property is changed.
IDesignerHost offers the idea of transactions, which can be used to fabricate an undo action that spans multiple smaller actions.
With these features, UndoEngine can fabricate any undo units it needs automatically.
Note |
|---|
Do not change property values directly. The UndoEngine class requires you to use the appropriate TypeDescriptor to change property values. |
UndoEngine monitors for change notifications to create undo units, and the units themselves consist of serialized object states. The following table shows the services that must be available when UndoEngine is created.
Service | Description |
|---|---|
Saves property and object values for a component before and after a change is made. | |
Notifies the undo engine of changes made to components. | |
Used to track transactions. |
Note |
|---|
Because the UndoEngine class requires ComponentSerializationService and IComponentChangeService, it is available only at design time. |
The undo engine tracks transactions and creates a single undo unit that encompasses a transaction. As a result, the undo engine has control over the duration of an undoable action. Also, because transactions can be named, undoable actions inherit their names from the current transaction. If no transaction is available and a change is reported, the undo engine creates an undo name based on the type of change (for example, "Change property 'Text'").
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
