Background Worker How To

ぃ、小莉子 提交于 2019-12-01 09:31:59

Background workers are threads that run in the background and do work without interrupting/blocking your main thread.

You can read more here.

In quick terms:

In DoWork do your blocking operation. Whenever you can, report how far through you are with the operation using (sender as BackgroundWorker).ReportProgress(50); for example to report 50% completion.

You can have your main thread subscribe to the "ProgressChanged" event, which can update GUI or do other tasks which should occur when the progress has changed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!