CAB Background Worker Bug

Topics: CAB & Smart Client Software Factory
Aug 5, 2005 at 6:31 AM
originally posted by: RyanF

Hi All,

Can someone comment on the BackgroundWorker object, as utilized in the CAB? The quickstart that is included in the CAB (the EventBroker QS) uses the Event publication method as the background thread, and uses the ReportProgress method to update the UI (on the UI thread).

However, it does not expose the DoWork event or the RunAsyncMethod to use the DoWorkEventArgs class.

The DoWorkEventArgs class is what contains the e.Result object which gets populated in the RunWorkerCompletedEventArgs class (the EventArgs that is passed to RunWorkerCompleted) as the result of the async operation.

In the quickstart, it does not use this structure, although it does refer to it in the RunWorkerCompleted method, and the value is null if you run the demo.

I've tried various ways to manipulate the CAB's ThreadOption.BackgroundWorker to get the worker's DoWork event to fire, and it just won't. So, my questions are, what is the correct way for the e.Result object (of the RunWorkerCompletedEventArgs) to get populated ? Alternatively, what other method exists in the CAB to communicate results from the async thread back to the UI thread?

Eventually, I just stripped out the CAB code and ran the BackgroundWorker manually.