LEADTOOLS Annotations for WPF and Silverlight (Leadtools.Windows.Annotations assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.31
Undo Method
See Also 
Leadtools.Windows.Annotations Namespace > AnnAutomation Class : Undo Method



The Undo Method supports WPF/Silverlight.

The Undo Method is available in LEADTOOLS Document and Medical Imaging toolkits.

Undoes the last operation performed in this AnnAutomation. Supported in Silverlight, Windows Phone 7

Syntax

Visual Basic (Declaration) 
Public Overridable Sub Undo() 
Visual Basic (Usage)Copy Code
Dim instance As AnnAutomation
 
instance.Undo()
C# 
public virtual void Undo()
C++/CLI 
public:
virtual void Undo(); 

Example

This example selects the first annotation object in the automation container, deletes it, performs an undo, and then redos the operation.

Visual BasicCopy Code
Private Sub AnnAutomation_Undo(ByVal automation As AnnAutomation)
   If automation.Container.Children.Count > 0 Then
      ' select the first object in the automation
      automation.StartEditing(CType(automation.Container.Children(0), AnnObject), False)
      MessageBox.Show("Object has been selected.  Next delete it")
      ' delete this object
      automation.Delete()
      MessageBox.Show("Object has been deleted.  Next undo the operation to bring the object back")

      ' undo the delete operation
      automation.Undo()
      MessageBox.Show("Operation has been undone and the object is back.  Next redo the operation to delete the object again")

      ' redo the delete operation
      automation.Redo()
      MessageBox.Show("Operation has been redone and the object is deleted again.")
   Else
      MessageBox.Show("No objects in the container!")
   End If
End Sub
C#Copy Code
private void AnnAutomation_Undo(AnnAutomation automation)
{
   if(automation.Container.Children.Count > 0)
   {
      // select the first object in the automation
      automation.StartEditing(automation.Container.Children[0] as AnnObject, false);
      MessageBox.Show("Object has been selected.  Next delete it");
      // delete this object
      automation.Delete();
      MessageBox.Show("Object has been deleted.  Next undo the operation to bring the object back");

      // undo the delete operation
      automation.Undo();
      MessageBox.Show("Operation has been undone and the object is back.  Next redo the operation to delete the object again");

      // redo the delete operation
      automation.Redo();
      MessageBox.Show("Operation has been redone and the object is deleted again.");
   }
   else
      MessageBox.Show("No objects in the container!");
}
SilverlightCSharpCopy Code
private void AnnAutomation_Undo(AnnAutomation automation)
{
   if(automation.Container.Children.Count > 0)
   {
      // select the first object in the automation
      automation.StartEditing(automation.Container.Children[0] as AnnObject, false);
      MessageBox.Show("Object has been selected.  Next delete it");
      // delete this object
      automation.Delete();
      MessageBox.Show("Object has been deleted.  Next undo the operation to bring the object back");

      // undo the delete operation
      automation.Undo();
      MessageBox.Show("Operation has been undone and the object is back.  Next redo the operation to delete the object again");

      // redo the delete operation
      automation.Redo();
      MessageBox.Show("Operation has been redone and the object is deleted again.");
   }
   else
      MessageBox.Show("No objects in the container!");
}
SilverlightVBCopy Code
Private Sub AnnAutomation_Undo(ByVal automation As AnnAutomation)
   If automation.Container.Children.Count > 0 Then
      ' select the first object in the automation
      automation.StartEditing(TryCast(automation.Container.Children(0), AnnObject), False)
      MessageBox.Show("Object has been selected.  Next delete it")
      ' delete this object
      automation.Delete()
      MessageBox.Show("Object has been deleted.  Next undo the operation to bring the object back")

      ' undo the delete operation
      automation.Undo()
      MessageBox.Show("Operation has been undone and the object is back.  Next redo the operation to delete the object again")

      ' redo the delete operation
      automation.Redo()
      MessageBox.Show("Operation has been redone and the object is deleted again.")
   Else
      MessageBox.Show("No objects in the container!")
   End If
End Sub

Remarks

This method will undo the last operation performed in this AnnAutomation if the CanUndo property returns true.

Use the UndoCapacity property to get or set the number of user actions that can be reversed using the Undo method, or re-applied using the Redo method. The default for the UndoCapacity property is 10 actions.

For more information, refer to Undoing WPF Automation Operations.

Requirements

Target Platforms: Silverlight 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only)

See Also

Undo requires a Document/Medical product license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features and Unlocking Special LEAD Features.