-
January 18th, 2014, 04:50 PM
#16
Re: Button/busyindicator in other than Click Event
Originally Posted by TBBW
using the background gives me an unstable program.
If I runs it 10 times it crashes 2 times randomly.
That is the fault of how you've coded it, not with background threading.
Here's what you're doing...
Originally Posted by TBBW
Pushing/clicking the install button results in the following
- Find File.
- Do a CRC check
- Run it
This is what you should be doing:
OnButtonClick event...
- Disable the button
- Prompt the user for the file(s)
- Create a BackgroundWorker.
- Wire up progress and completed events
- Start the thread, which...
- Find File.
- Do a CRC check
- Run it
- reports back to the main ui thread using the progress event.
- When the completed event fires, reenable the button.
Last edited by Arjay; January 18th, 2014 at 04:53 PM.
-
January 18th, 2014, 04:52 PM
#17
Re: Button/busyindicator in other than Click Event
The best thing to do is to create a small test app with a start button and when you click it you create the backgroundworker and wire up the events. You disable and reenable the start button and dummy up progress events.
Then when you have that working well, you incorporate the code into your real project and have the bw thread use the crc methods.
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
|