WPF匿名线程执行
Thread thread = new Thread(() => { 此处填写代码 });
thread.Start();
WPF线程启动
Thread thread = new Thread( 此处填写要执行的函数 );
thread.Start();
WPF线程中更新UI
this.Dispatcher.Invoke(DispatcherPriority.Normal, (ThreadStart)delegate { 此处填写代码 });
Demo
Thread thread = new Thread(() => {
this.Dispatcher.Invoke(DispatcherPriority.Normal, (ThreadStart)delegate {
CarInfoViewMode_.CarID = CarID;
CarInfoViewMode_.CarProvince = Ytools.proCode2str(province);
CarInfoViewMode_.CarArea = SqlHelper.sendSQL(str);
CarInfoViewMode_.CarType = Ytools.typeCode2str(size);
});
});