wpf:
Lora.RecieveAll = (loraframe) =>{ThreadPool.QueueUserWorkItem(delegate{SynchronizationContext.SetSynchronizationContext(newDispatcherSynchronizationContext(System.Windows.Application.Current.Dispatcher));SynchronizationContext.Current.Post(pl =>{ObservableC.Add(loraframe);}, null);});};
uwp:
Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,() =>{// Your UI update code goes here!});
2.winform中使用this.invoke()
wpf中使用 this.dispatcher.invoke( (action)delegate {改变ui})
