|
-
Jul 17th, 2007, 11:33 AM
#1
Thread Starter
Fanatic Member
[2.0] Background Worker Status [Resolved]
I have a background worker thread and I need it to periodically send up notices pertaining to what it's currently doing. I see it has a "progressChanged" event, but I need more than just a %.
Is there anyway to Assign public properites to this thread?
Or perhaps custom events?
How do I get the worker thread to throw up more data than just the % completed?
Last edited by JPicasso; Jul 18th, 2007 at 05:49 AM.
Merry Christmas
-
Jul 17th, 2007, 02:13 PM
#2
Re: [2.0] Background Worker Status
The BackroundWorker is capable of changing class level read/write variables!!
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Jul 17th, 2007, 06:22 PM
#3
Thread Starter
Fanatic Member
Re: [2.0] Background Worker Status
That was not my experience.
The thread is spawned from a form. I wish to have the form display the current
status and other information about what the worker thread is, well, working on.
When we used threads in the past, we had to marshal events over to the "spawning"
thread, before we could do any UI updates.
I was looking to avoid managing an entire thread and just wanted my worker thread to
post messages to the form. Looks like I may just have to bite the bullet and spawn a regular thread.
I"m not at work now, but I'll take a look in the morning.
-
Jul 18th, 2007, 01:33 AM
#4
Re: [2.0] Background Worker Status
When you call ReportProgress you can pass any object to the second argument. You get that object back from the e.UserState property in the ProgressChanged event handler. Because it can be any object you can use it for anything you like.
-
Jul 18th, 2007, 05:48 AM
#5
Thread Starter
Fanatic Member
Re: [2.0] Background Worker Status
Holy moly. I was so close, yet, so far away.
Somehow my brain shut down after seeing the "int Percentage" and ruled that method out.
Thanks to both of you.
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
|