Background Worker How To

后端 未结 1 719
傲寒
傲寒 2021-01-15 03:11

I\'m trying to implement background worker into my program, so that it wont freeze when i run the program and starts retrieving the data I need.

I\'m not quite sure

相关标签:
1条回答
  • 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.

    0 讨论(0)
提交回复
热议问题