Click or drag to resize

UndoCollection Class

The UndoCollection class is used to manage operations that need undo/redo functinality. The collection contains properties to specify the number of allowed operations to undo or redo.

Inheritance Hierarchy
SystemObject
  SystemMarshalByRefObject
    Atalasoft.ImagingMarshalByRefReadOnlyCollectionBase
      Atalasoft.ImagingUndoCollection

Namespace:  Atalasoft.Imaging
Assembly:  Atalasoft.dotImage (in Atalasoft.dotImage.dll) Version: 11.4.0.9.0.377 (.NET 4.5.2, x86)
Syntax
public class UndoCollection : MarshalByRefReadOnlyCollectionBase, 
	IDisposable

The UndoCollection type exposes the following members.

Properties
  NameDescription
Public propertyCount
The number of items in the collection.
(Inherited from MarshalByRefReadOnlyCollectionBase.)
Protected propertyInnerList
Gets the ArrayList stored within the collection.
(Inherited from MarshalByRefReadOnlyCollectionBase.)
Public propertyIsSynchronized

Gets a value indicating whether access to the collection is synchronized (thread-safe).

(Inherited from MarshalByRefReadOnlyCollectionBase.)
Public propertyItem
Gets the undo item.
Public propertyLevels
Gets or set the number of Undo levels in this collection.
Public propertyNumRedos
Gets the current number of redos in the collection.
Public propertyNumUndos
Gets the current number of undos in the collection.
Public propertySyncRoot

Gets an object that can be used to synchronize access to the collection.

(Inherited from MarshalByRefReadOnlyCollectionBase.)
Top
Methods
  NameDescription
Public methodAdd
Add a new undo level to the undo collection specifying the description and if the Image is copied.
Public methodClear
Clears the undo/redo collection items.
Public methodCopyTo(Array, Int32)
Copies the collection items into an array.
(Inherited from MarshalByRefReadOnlyCollectionBase.)
Public methodCopyTo(UndoLevel, Int32)

Copies the UndoLevels into an array.

Public methodCreateObjRef
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject.)
Public methodDispose
Clean up unmanaged resources by disposing each AtalaImage in the collection.
Protected methodDispose(Boolean)
Releases unmanaged and - optionally - managed resources.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Finalizes an instance of the UndoCollection class.
(Overrides ObjectFinalize.)
Public methodGetEnumerator
Returns a reference to an IEnumerator interface, whose purpose is to grant access to an enumeration's items.
(Inherited from MarshalByRefReadOnlyCollectionBase.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetLifetimeService
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInitializeLifetimeService
Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodMemberwiseClone(Boolean)
Creates a shallow copy of the current MarshalByRefObject object.
(Inherited from MarshalByRefObject.)
Protected methodOnGetCurrentImageCollection
Raises the [E:GetCurrentImageCollection] event.
Protected methodOnNewImageCollection
Raises the [E:NewImageCollection] event.
Public methodCode exampleRedo
The Redo method redo's the most recent udno in this UndoCollection.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodCode exampleUndo
The Undo method undo's the most recently added item to this UndoCollection.
Top
Remarks

NOTE: The UndoCollection class is intended for use in the Workspace class only, and should not be used on its own. The UndoCollection relies on the Workspace'sImageCollection in order to save the current images.

The undo collection may be used to create an Undo/Redo menu in your project. The Add method should be called at the point you want to save as the 'undo point' (for examble, BEFORE an ImageCommand is applied). To undo or redo an operation, simply call the Undo or Redo methods. You can access the Description property to determine what the next undo or redo will accomplish. The following code example shows how this is done.

Examples

Accessing the description of the next operation to undo/redo.

UndoDescriptionCS (C#)
WorkspaceViewer Viewer;
...
string undoDescription = Viewer.Undos[Viewer.Undos.Count - Viewer.Undos.NumUndos].Description;
string redoDescription = Viewer.Undos[Viewer.Undos.Count - Viewer.Undos.NumUndos - 1].Description;
UndoDescriptionVB (Visual Basic)
Dim Viewer As WorkspaceViewer
...
Dim undoDescription As String = Viewer.Undos(Viewer.Undos.Count - Viewer.Undos.NumUndos).Description 
Dim redoDescription As String = Viewer.Undos(Viewer.Undos.Count - Viewer.Undos.NumUndos - 1).Description
See Also