tags:

views:

127

answers:

1

Hi

I have an app which consist of three windows.

Main Window Settings Window Find Window

A dll needs to be initialized. THis is little time consuming, so i have it done via the backgroundworker. The backgroundworker is a private member of Main Window.

I need to check the status of the backgroundworker in the find window too. I can pass a reference of main window to find window and check the backgroundworker status.But is this way i have to do it. Or should i have the backgroundwroker in a seperate class(A singleton maybe) and check the status of the backgroundworker through that??

Not much experience in C# GUI programming.

Thanks

+1  A: 

If the entire purpose of the BackgroundWorker is to load a DLL without clogging up the UI message pump and to be able to be queried in odd spots, I would probably go with a singleton/static class.

You can then can design custom events that each window can attach to, to monitor the current state of the loading process.

That being said, it's dependant on how you've set up the relationship between the main window and the find window.

If the main window does all of the find window creation, then another option would be attach the background workers events to public methods on the find window.

I think both of these would would well, but i'm sure someone else with more knowledge will enlighten us both :)

Alastair Pitts