/// <summary> /// Event handler called when the background task is completed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void OnCompleted(IBackgroundTaskRegistration sender, BackgroundTaskCompletedEventArgs e) { // Update the UI with progress reported by the background task await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { try { // Rethrow any exception that occurred in the background task. e.CheckResult(); // Update the UI with the completion status of the background task // The Run method of the background task sets this status. MainPage.ReportSavedStatus(); // Extract and display location data set by the background task if not null ScenarioOutput_Latitude.Text = MainPage.LookupSavedString("Latitude", "No data"); ScenarioOutput_Longitude.Text = MainPage.LookupSavedString("Longitude", "No data"); ScenarioOutput_Accuracy.Text = MainPage.LookupSavedString("Accuracy", "No data"); } catch (Exception ex) { // The background task had an error _rootPage.NotifyUser(ex.ToString(), NotifyType.ErrorMessage); } }); }