WPF C#。我有一個綁定到不同方法的方法。 服務器發送一個hello world。WPF多線程。更改第三方流程的接口
var clientobj =
(OperClass) Activator.GetObject
(
typeof (OperClass),
"tcp ://localhost: 100001/TcpClient"
);
clientobj.Update ("HELLO WORLD");
客戶端應用程序:
public void Update (string msg)
{
label1.text = msg;// error thread
}
中的程序被用於通信RemotingServices.Marshal。 如何將文本更改爲label1。 調度員沒有幫助。
什麼錯誤,你得到什麼?當試圖設置'label1.Text'時它是一個跨線程錯誤嗎? – 2012-02-07 09:54:47
是的,你是正確的這個錯誤。無法獲得控制流,因爲該項目未在其線程中創建。 – Feor 2012-02-07 10:01:56