开发者

Rerunning DoWork on Background Worker Based on Result?

Let's say I have a backgroundWorker1_DoWork that finds a value in a database and returns it in e.Result. Let's say I also have a backgroundWorker1_Run开发者_如何学JAVAWorkerCompleted that reads the result.

What I want to be able to do is based on e.Result, I can re-run backgroundWorker1_DoWork, and this I am not sure how to do.

I'd really appreciate any help.


The same way you are doing it the first time - by invoking the RunWorkerAsync method:

backgroundWorker1.RunWorkerAsync();

Make sure the invocation is conditioned or this loop may run forever :-)


Can't you restart your BackgroundWorker after testing e.Result in your backgroundWorker1_RunWorkerCompleted event?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜