←Select platform

Run Event

Summary
Occurs when an AnnObject is being run.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public event EventHandler<AnnRunDesignerEventArgs> Run 
- (void)automation:(LTAnnAutomation *)automation run:(LTAnnRunDesignerEventArgs *)args; 
public void addRunDesignerListener(AnnRunDesignerListener listener) 
public void removeRunDesignerListener(AnnRunDesignerListener listener) 
public:  
   event EventHandler<AnnRunDesignerEventArgs^>^ Run 
def Run(sender,e): # sender: AnnAutomation e: Leadtools.Annotations.Engine.AnnRunDesignerEventArgs 
Event Data

The event handler receives an argument of type AnnRunDesignerEventArgs containing data related to this event. The following AnnRunDesignerEventArgs properties provide information specific to this event.

PropertyDescription
Cancel A value indicating whether the run operation should be canceled.
Remarks

When an object is being run, the automation object will hook the object run designer's AnnRunDesigner.Run to this event. Therefore, instead of hooking and unhooking to the various designers run events, you can simply subscribe to this event once.

Example

This example will show how to track when an object is run.

Start with the AnnAutomationManager example, remove all the code inside the example function (search for the // TODO: add example code here comment) and insert the following code:

Draw a couple of objects and then click the example button. Now you switch into run mode and whenever you click on an object, a message will show.

C#
using Leadtools.Annotations.Automation; 
 
using Leadtools.Annotations.Engine; 
using Leadtools.Codecs; 
using Leadtools.Controls; 
using Leadtools.Annotations.Rendering; 
using Leadtools.Annotations.WinForms; 
 
public void AnnAutomation_Run() 
{ 
   // Switch to run mode 
   _automation.Manager.UserMode = AnnUserMode.Run; 
 
   // Hook to the automation's Run event 
   _automation.Run += _automation_Run; 
} 
 
void _automation_Run(object sender, AnnRunDesignerEventArgs e) 
{ 
   if (e.OperationStatus == AnnDesignerOperationStatus.Start) 
   { 
      // Get the object being run 
      Debug.WriteLine("In run mode, you clicked an object of id " + e.Object.Id); 
   } 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Annotations.Automation Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.