开发者

Stuck trying to create an async method

For the last week I've been trying to create an async metho开发者_如何学JAVAd. 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?


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜