UndoEngine Class
TOC
Collapse the table of content
Expand the table of content

UndoEngine Class

 

Specifies generic undo/redo functionality at design time.

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

System.Object
  System.ComponentModel.Design.UndoEngine

[<AbstractClass>]
type UndoEngine = 
    class
        interface IDisposable
    end

NameDescription
System_CAPS_protmethodUndoEngine(IServiceProvider)

Initializes a new instance of the UndoEngine class.

NameDescription
System_CAPS_pubpropertyEnabled

Enables or disables the UndoEngine.

System_CAPS_pubpropertyUndoInProgress

Indicates if an undo action is in progress.

NameDescription
System_CAPS_protmethodAddUndoUnit(UndoEngine.UndoUnit)

Adds an UndoEngine.UndoUnit to the undo stack.

System_CAPS_protmethodCreateUndoUnit(String, Boolean)

Creates a new UndoEngine.UndoUnit.

System_CAPS_protmethodDiscardUndoUnit(UndoEngine.UndoUnit)

Discards an UndoEngine.UndoUnit.

System_CAPS_pubmethodDispose()

Releases all resources used by the UndoEngine.

System_CAPS_protmethodDispose(Boolean)

Releases the unmanaged resources used by the UndoEngine and optionally releases the managed resources.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_protmethodGetRequiredService(Type)

Gets the requested service.

System_CAPS_protmethodGetService(Type)

Gets the requested service.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodOnUndoing(EventArgs)

Raises the Undoing event.

System_CAPS_protmethodOnUndone(EventArgs)

Raises the Undone event.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubeventUndoing

Occurs immediately before an undo action is performed.

System_CAPS_pubeventUndone

Occurs immediately after an undo action is performed.

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.

System_CAPS_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.

System_CAPS_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
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft