Example #1
0
        private async void startStopButton_Click(object sender, RoutedEventArgs e)
        {
            if (BackgroundManager.IsBackgroundTaskRegistered())
            {
                BackgroundManager.UnregisterBackgroundTask();
                BackgroundManager.UnRegisterBackgroundTaskEventHandlers(_taskCompletedHandler, _progressEventHandler);
            }
            else
            {
                await BackgroundManager.RegisterBackgroundTask(CommonData.GUID, CommonData.ServiceName, CommonData.ServiceDescriptor);

                BackgroundManager.RegisterBackgroundTaskEventHandlers(_taskCompletedHandler, _progressEventHandler);
            }

            updateBGStatus();
        }
Example #2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            updateBGStatus();

            BackgroundManager.RegisterBackgroundTaskEventHandlers(_taskCompletedHandler, _progressEventHandler);
        }