How to use WPF Background Worker

前端 未结 4 1215
孤独总比滥情好
孤独总比滥情好 2020-11-22 05:53

In my application I need to perform a series of initialization steps, these take 7-8 seconds to complete during which my UI becomes unresponsive. To resolve this I perform t

4条回答
  •  自闭症患者
    2020-11-22 06:55

    You may want to also look into using Task instead of background workers.

    The easiest way to do this is in your example is Task.Run(InitializationThread);.

    There are several benefits to using tasks instead of background workers. For example, the new async/await features in .net 4.5 use Task for threading. Here is some documentation about Task https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task

提交回复
热议问题