开发者

Accessing UI thread of a form?

开发者 https://www.devze.com 2022-12-24 16:12 出处:网络
I\'m using C# and I\'m making an application where a lot of UI loading must be done in background. Is it possible to do it unsafely and ignore 开发者_JAVA百科InvalidOperationExceptions? The only way I

I'm using C# and I'm making an application where a lot of UI loading must be done in background. Is it possible to do it unsafely and ignore 开发者_JAVA百科InvalidOperationExceptions? The only way I found it to put try...catch statements around every single line of code but this will take ages as there is too much code.


Updating UI directly from threads is a bad thing. If you have multiple threads trying to update, then you are in trouble, If you are sure that only that thread is going to update the UI,

use this before invoking the thread

CheckForIllegalCrossThreadCalls =False
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号