protected override void OnNavigatedTo(NavigationEventArgs e) { // Set our initial UI state based on whether the background task is registered. IBackgroundTaskRegistration taskRegistration = MainPage.FindBackgroundTaskRegistration(); UpdateBackgroundTaskUIState(taskRegistration != null); }
protected override void OnNavigatedTo(NavigationEventArgs e) { if (MainPage.FindBackgroundTaskRegistration() == null) { rootPage.NotifyUser(TaskNotRegisteredMessage.Text, NotifyType.ErrorMessage); OpenSettingsButton.IsEnabled = false; } }
// Handle request to unregister the background task private void UnregisterTask() { IBackgroundTaskRegistration taskRegistration = MainPage.FindBackgroundTaskRegistration(); if (taskRegistration != null) { taskRegistration.Unregister(true); rootPage.NotifyUser("Unregistered Caller ID background task.", NotifyType.StatusMessage); } UpdateBackgroundTaskUIState(false); }