UndoEngine Class

Specifies generic undo/redo functionality at design time.

System.Object
  System.ComponentModel.Design.UndoEngine

Namespace:  System.ComponentModel.Design
Assembly:  System.Design (in System.Design.dll)

'Declaration
Public MustInherit Class UndoEngine _
	Implements IDisposable

The UndoEngine type exposes the following members.

  NameDescription
Protected methodUndoEngineInitializes a new instance of the UndoEngine class.
Top

  NameDescription
Public propertyEnabledEnables or disables the UndoEngine.
Public propertyUndoInProgressIndicates if an undo action is in progress.
Top

  NameDescription
Protected methodAddUndoUnitAdds an UndoEngine.UndoUnit to the undo stack.
Protected methodCreateUndoUnitCreates a new UndoEngine.UndoUnit.
Protected methodDiscardUndoUnitDiscards an UndoEngine.UndoUnit.
Public methodDisposeReleases all resources used by the UndoEngine.
Protected methodDispose(Boolean)Releases the unmanaged resources used by the UndoEngine and optionally releases the managed resources.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Protected methodGetRequiredServiceGets the requested service.
Protected methodGetServiceGets the requested service.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOnUndoingRaises the Undoing event.
Protected methodOnUndoneRaises the Undone event.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public eventUndoingOccurs immediately before an undo action is performed.
Public eventUndoneOccurs immediately after an undo action is performed.
Top

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.

NoteNote

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

ComponentSerializationService

Saves property and object values for a component before and after a change is made.

IComponentChangeService

Notifies the undo engine of changes made to components.

IDesignerHost

Used to track transactions.

NoteNote

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'").

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft