|
-
May 5th, 2009, 07:52 PM
#2
Re: Cancelling progress Background worker
That's pretty much it except there's no point calling CancelAsync in the DoWork event handler. All calling CancelAsync does is set CancellationPending to True. CancelAsync is only useful when called from the UI thread in order to signal to the secondary thread that the operation should be cancelled, in which case e.Cancel is set to True and you return. If you're already in the secondary thread and you want to cancel then you would simply set e.Cancel to True and return, which you're already doing. Calling CancelAsync is redundant.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|