This is the preferred way:
Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { // Your UI update code goes here! });
The advantage is that it gets the core CoreApplicationView and is therefore always available. More details here .
There are two alternatives that you could use.
First alternative
Windows.ApplicationModel.Core.CoreApplication.GetCurrentView().CoreWindow.Dispatcher
This gets the active view for the application, but it will give you a null value if no views have been activated. More details here .
Second alternative
Window.Current.Dispatcher
This solution will not work if it is called from another thread, as it returns null instead of the interface manager. More details here .
MAXE Aug 28 '13 at 10:25 2013-08-28 10:25
source share