I’m writing a .NET Windows forms application that is to be used for importing a lot of data and doing various calculations on each import. For this purpose, I’ve created one “main” worker and several “child” workers.
The import jobs are all listed within a MySql database and I’ve set up a function that checks if job exist or not.
What I need to know is where the control is passed to after the child workers are finished doing their jobs? Do they need to call the main worker again for it to run and assign jobs to the child workers?
The main worker is called upon form load event. So if I run my main worker for the first time and initiate work at child level, will the main worker pass control to the form load again?
I cannot do a test run since my import jobs each cost money (for API usage/hits). So I want to write the app as much as possible before carrying out a test run.
Yes, once you start the background work, control returns to the calling method while the work gets processed on another thread.
You can create an event handler that notifies you when the background work is completed.
A complete usage example can be found here:
http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx