Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cancel a long running process
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00945712
Message ID:
00945850
Vues:
17
Hi Matthew,

How do you call the calculation from the Ok button? Do you use delegates?
If you run the calculation on the same thread as the UI, I doubt that you can cancel it, even if you do Application.DoEvents. Your cancel will be called after the calculation is done, because DoEvents is queueing all the requests and processes them sequentially.

My suggestion is to use delegates for the time consuming calculation.

I ran into a similar issue but in my case I used async callback with delegates.
From the main UI I instantiate an object that handles the calculation,and inside the object I invoke the delegate asynchronously.;
If the user wants to cancel the process, what I do is, I keep a reference to the asynccallback in the calculation handler class and call AsyncWaitHandle.Close() on it. For me, this trick did it.

Hope it helps,

Vlad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform