实现自定义BackgroundWorker
我正在尝试在 .NET 1.1 中实现 BackgroundWorker(因为没有),但我不太熟悉线程和委托。
现在我有一个名为BackgroundWorker 的类,其中包含一个名为DoWork
的方法。我知道我必须在 BackgroundWorker 中创建一个线程并在该线程中执行委托,但有两件事我还不太清楚。
如果 DoWork 收到无参数委托,如何在 BackgroundWorker 中启动线程?或者我应该使用委托以外的其他方法?
如何实现
ProgressChanged
事件?
I'm trying to implement a BackgroundWorker
in .NET 1.1 (since there isn't any) and I'm not quite versed in threading and delegates.
Right now I have a class call BackgroundWorker with a method called DoWork
. I know I must create a thread in the BackgroundWorker and execute a delegate in that thread, but there are two things I don't have quite clear yet.
How can I start the thread in BackgroundWorker if DoWork receives a parameterless delegate? Or should I use another approach other than the delegate?
How can I implement the
ProgressChanged
event?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Juval 已完成 1.1
http://www.code-magazine .com/articleprint.aspx?quickid=0403071&printmode=true
Already done by Juval for 1.1
http://www.code-magazine.com/articleprint.aspx?quickid=0403071&printmode=true