Application.Current.Dispatcher.Invoke UWP analog

爷,独闯天下 提交于 2019-12-11 16:31:58

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!