解决多线程中夸线程操作 UI或者集合 造成的 跨线程操作
线程间操作无效:从不是创建控件XXXX的线程访问它
步骤1:初始化
在App.cs中 重写 OnStartup
protected override void OnStartup(StartupEventArgs e)
{
//初始化UI Dispatcher
Execute.InitializeWithDispatcher();
}
步骤2:使用
//UI线程执行
Execute.OnUIThread(() =>
{
//执行操作
});