C#确定当前线程是否是主GUI线程。 [英] C# Determine if the current thread is the main GUI thread.
本文介绍了C#确定当前线程是否是主GUI线程。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嘿所有,
只是好奇,有没有人知道是否有办法检查当前正在执行的线程是否是主要的WPF GUI线程?
我想拥有它,以便当前线程是WPF GUI线程时,非线程远程调用将失败。原因是长时间运行的调用会锁定GUI,在此期间,我们希望它保持响应。
检查它是否是背景线程做的伎俩?
谢谢!
解决方案
任何人都有任何想法?
< blockquote>你能用System.Reflection命名空间吗?
嗯这怎么办?
Hey All,
Just curious, does anyone know if there is a way to check if the current executing thread is the main WPF GUI thread?
I want to have it so that a non-threaded remoting call will fail if the current thread is the WPF GUI thread. The reason for this is that a long running call locks up the GUI, and during this time, we would like it to stay responsive.
Does checking to see if it''s a background thread do the trick?
Thanks!
解决方案
Anyone have any ideas?
Can you do it with the System.Reflection namespace?
hmmmm how would that work?
这篇关于C#确定当前线程是否是主GUI线程。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文