Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.5.8
|
Leadtools.Dicom.AddIn Namespace : AsyncHelper Class |
public static class AsyncHelper
'Declaration Public MustInherit NotInheritable Class AsyncHelper
'Usage Dim instance As AsyncHelper
public ref class AsyncHelper abstract sealed
Executes an asynchronous method.
Imports Leadtools.Dicom.AddIn <TestMethod()> _ 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
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"); }