0

I want to execute one delegate on the main(UI) thread. However, I do not get that thread at run time due to a third-party plugin (ESRI). This plugin starts on receiving messages from a web application through a third-party DLL file in the form of XML. The strange thing is that, on receiving the message, further execution of the (ESRI) plugin starts on a different thread, say ID = 3.

When I run this third-party plugin standalone, (like adding button and on click of that button execute further code) it doesn't throw any exception. In this case, code executes in the main (UI) thread, like thread ID = 1.

Is there a way (in C#) to execute code on the required thread, say thread ID =1?

Note: As it is a third-party plugin, we do not get any control over any windows control/form. We can't even add a control through it.

4

1 回答 1

0

您可以使用它来运行 UIThread 中的任何代码

Deployment.Current.Dispatcher.BeginInvoke(() => { /* UI code here*/ });
于 2013-05-29T01:52:09.817 回答