1
2
3
4
5
6
7
8
9
ThreadPool.QueueUserWorkItem(delegate
{
SynchronizationContext.SetSynchronizationContext(new
System.Windows.Threading.DispatcherSynchronizationContext(Application.Current.Dispatcher));
SynchronizationContext.Current.Post(pl =>
{
//这里写要执行的代码
}, null);
});

复制粘贴能跑就行