My program.cs calls the parent mdi frmMain. FrmMain then opens up various child forms based on user action.
All processing logic is written in BusinessLogic.cs. frmMain at load calls the BusinessLogic.cs methods to initially populate the data. The child also calls BusinessLogic to retrieve data and process it. I would like to do all this through BackGroundWorker, i.e. FrmMain calls (for example) the StartBGWorker () method of BusinessLogic.cs, and this method creates a background worker for this particular call, raises the Do_work event, fetch and process, and closes when done.
I do not understand how to instantiate and events for backgroundworker. So how exactly do I use backgroundworker in the class file?
Edit: Perhaps my logic is wrong, and I should add BGW for each form that calls BusinessLogig.cs. Then whenever I call the BusinessLogic method, I can do this through the backgroundworker. Would it be better to implement?
Edit2: Feel a little idiotic about my doubts now that I have found a way. I just created a public static method with the initial BGW code in BusinessLogic. Now that I need to do the processing, I first call this method from my forms. I would like to know if my implementation of BGW is standard or is there a way to improve the design.
source share