问题
Which is an analogue of Application.Current.Dispatcher.Invoke (such as WPF) exists in UWP?Application.Current.Dispatcher.Invoke(() =>
{
//some code here
});
回答1:
Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
() =>
{
// Do your stuff here
});
This will run your code on the UI thread, change the CoreDispatcherPriority.Normal to your liking.
来源:https://stackoverflow.com/questions/54886699/application-current-dispatcher-invoke-uwp-analog