views:

50

answers:

2

For the last week I've been trying to create an async method. I tried the MSDN article How to: Implement a Component That Supports the Event-based Asynchronous Pattern but it does the work in a method in the same class. The work I'm doing is a lot more complicated and is its own class. The problem I'm having is the class doing the work cannot post the progress or completion as the methods that handle this stuff is in the parent class.

Does anyone have any suggestions on how to fix this?

+1  A: 

Thanks for the answers chaps - simple (and stupid) mistake - just made the event Shared in the parent class and Bob's you Uncle!

Alex
Bob is my aunt.
Hogan
A: 

It also sounds like you should consider the Asyncronous Processing Model (i.e deriving from IAsyncResult).The model supports three rendezvous techniques: wait-unti-done, method callback and polling. But you re free to implement progress functionality beyond the polling (e.g. exposing an event or delegate, or acceptig a process callback).

Jeff Richter has written extensivly about this model in MSDN. Start here:

http://msdn.microsoft.com/en-us/magazine/cc163467.aspx

jnielsen