←Select platform

Execute(Action) Method

Summary

Executes the specified delegate.

Syntax

C#
VB
C++
public static AsyncResult Execute( 
   Action d 
) 
  
Public Overloads Shared Function Execute( _ 
   ByVal d As Action _ 
) As Leadtools.Dicom.Addin.AsyncResult 
public: 
static Leadtools.Dicom.Addin.AsyncResult^ Execute(  
   Action^ d 
)  

Parameters

d
The delegate to execute asynchronously.

Return Value

The asynchronous result.

Example

Executes an ansynchronous method.

C#
VB
using Leadtools.Dicom.AddIn; 
 
public void ThreadFunction() 
{ 
   for (int i = 0; i < 1000; i++) 
   { 
      Console.WriteLine("Count: {0}", i); 
   } 
} 
public void TestExecute() 
{ 
   AsyncResult r = AsyncHelper.Execute(new Action(ThreadFunction)); 
 
   // 
   // Wait 1 second for the thread to finish. 
   // 
   r.Wait(1000); 
   if (r.IsCompleted) 
      Console.WriteLine("Completed"); 
} 
Imports Leadtools.Dicom.AddIn 
 
Public Sub ThreadFunction() 
   For i As Integer = 0 To 999 
      Console.WriteLine("Count: {0}", i) 
   Next i 
End Sub 
 
Public Sub TestExecute() 
   Dim r As AsyncResult = AsyncHelper.Execute(New Action(AddressOf ThreadFunction)) 
 
   ' 
   ' Wait 1 second for the thread to finish. 
   ' 
   r.Wait(1000) 
   If r.IsCompleted Then 
      Console.WriteLine("Completed") 
   End If 
End Sub 

Requirements

Target Platforms

Help Version 19.0.2017.10.28
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom.AddIn Assembly