UndoManager Class

Provides the functionality for undo and redo operations.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Modeling.UndoManager

Namespace:  Microsoft.VisualStudio.Modeling
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.12.0 (in Microsoft.VisualStudio.Modeling.Sdk.12.0.dll)

Syntax

'Declaration
Public Class UndoManager _
    Implements IDisposable
public class UndoManager : IDisposable
public ref class UndoManager : IDisposable
type UndoManager =  
    class 
        interface IDisposable 
    end
public class UndoManager implements IDisposable

The UndoManager type exposes the following members.

Constructors

  Name Description
Public method UndoManager(Context) constructor.
Public method UndoManager(Store) constructor.

Top

Properties

  Name Description
Protected property CanUndoRedoCallbackCollection
Public property Context The Context that contains the UndoManager
Public property InRedo Return whether are not the undo manager is in the middle of a redo or not.
Public property InUndo Return whether are not the undo manager is in the middle of an undo or not.
Public property MaxUndoableTransactions Maximum number of undo items visible on the undo stack
Public property RedoableTransactions List of redoable TransactionItems maintained by the UndoManager.
Public property RedoCount Number of items in redo stack
Public property Store The Store that contains the UndoManager
Public property TopmostUndoableTransaction Return topmost transaction ID in undo stact
Public property UndoableTransactions List of undoable TransactionItems maintained by the UndoManager.
Public property UndoCount Number of items in undo stack.
Public property UndoState The state of Undo.

Top

Methods

  Name Description
Public method AddCanUndoRedoCallback Add CanUndoRedo voter.
Public method AddUndoableAction Add an undoable action to the undo stack. This will clear the redo stack.
Public method Dispose Dispose method
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Finalizer (Overrides Object.Finalize().)
Public method Flush Flush the undo and redo stacks. If we are in the middle of a transaction, throw an exception.
Public method FlushRedoStack Clears the redo stack.
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Redo() Redo the actions of the topmost transaction on the redo stack.
Public method Redo(Guid) Redo the actions committed in the transaction whose id is passed in. Make sure the id passed in is the transaction that is on top of the stack. Otherwise throw an exception.
Public method RedoAllPossible Redo all possible transactions on redo stack.
Public method RemoveCanUndoRedoCallback Remove CanUndoRedo voter.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method Undo() Undo the actions of the topmost transaction on undo stack.
Public method Undo(Guid) Undo the actions committed in the transaction whose id is passed in. Make sure the id passed in is the transaction that is on top of the stack. Otherwise throw an exception.
Public method UndoAllPossible Undo all transactions in undo stack that can be undone.

Top

Events

  Name Description
Public event RedoStackFlushed Allows clients to receive an event when the redo stack is flushed
Public event UndoItemAdded Event that is fired every time an undo item is added to the undo stack
Public event UndoItemDiscarded Event that is fired every time an undo item is discarded from the undo stack because the stack size exceeded the maximum number of undo items permitted.
Public event UndoStackFlushed Allows clients to receive an event when the undo stack is flushed

Top

Thread Safety

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

See Also

Reference

Microsoft.VisualStudio.Modeling Namespace

Other Resources

Using Transactions