是不是因为没有切换到UI线程啊?
你可以尝试一下把说跨线程调用的语句放入
this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new DelegateHandle(delegate()
{}
这个里面试试?
你可以尝试一下把说跨线程调用的语句放入
this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new DelegateHandle(delegate()
{}
这个里面试试?
// This delegate enables asynchronous calls for setting
// the text property on a TextBox control.
delegate void SetTextCallback(string text);
private void SetText(string text)
{
// InvokeRequired required compares the thread ID of the
// calling thread to the thread ID of the creating thread.
// If these threads are different, it returns true.
if (this.textBox4.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(SetText);
this.Invoke(d, new object[] { text });
}
else
{
this.textBox4.Text = text;
}
}