我如何从单独的线程更新 Windows 通用应用程序的 UI?

How can i update the UI of my Windows universal app from a seperate thread?

我在 Windows 8 phone 上有一个使用 C# 和 XAML 的警报应用程序。当我在应用程序 运行 时收到通知时,我能够使用此代码更新 UI。

   private void PushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
    {
        Dispatcher.BeginInvoke(async () =>
        {
           Textboc.text = "Something";
        });
    }

不过,我现在已将我的应用程序移至 Windows 10 Universal。 Dispatcher.BeginInvoke 好像没有。有没有其他方法可以用来更新 UI?

await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
        CoreDispatcherPriority.Normal,
        () => { // your code should be here});

Correct way to get the CoreDispatcher in a Windows Store app