Prevent UI from freezing without additional threads

前端 未结 7 2045
耶瑟儿~
耶瑟儿~ 2020-12-16 04:48

What solutions do I have if I want to prevent the UI from freezing while I deserialize a large number of UI elements in WPF? I\'m getting errors complainig that the objects

7条回答
  •  时光取名叫无心
    2020-12-16 05:28

    Recommendations from the OldNewThing blog.

    It is best if you do go the threaded route, to have one GUI thread and spawn your work load off to another thread that when finishes reports back to the main GUI thread that its done. The reason for this is because you will not get into thread issues with your GUI interface.

    So One GUI Thread Many worker threads that do the work.

    If any of your threads do hang the user is in direct control over your application can can close down the thread without effecting his experience with the application interface. This will make him happy because your user will feel in control other than him constantly click THAT STOP BUTTON AND IT WONT STOP SEARCHING.

提交回复
热议问题