Where to use backgroundworker

Topics: CAB & Smart Client Software Factory
Aug 23, 2007 at 5:48 PM
Should i be using the backgroundworker in the presenter or in the view?

Currently i have been using it in the presenter and then the presenter once completed makes a call to the view

So something like this

In View:

In Presenter: (presenter calls function on view once the async operation is completed)
View.UpdateCarrierList(Carrier[] carriers);

I have ALOT of these since i need to load a lot of data and dont want to tie up the UI but im not sure if this is the proper way of doing things...should i be usig the backgroundworker in the view instead?

Aug 24, 2007 at 7:56 PM
Hi, from my experience I think that your aproach is the right one.

The idea is to keep the view with the minimum posible logic (only with UI-specific logic).

The view class manages the controls on the form, and it forwards events to a presenter class. The presenter contains the logic to respond to the events, and in turn, manipulates the state of the view.

Please let me know if this helps,

Ezequiel Jadib
Aug 24, 2007 at 9:34 PM
Yes this does...if i take the italic sentance word for word, thats exactly what i am doing :)