/// <summary>
        /// Register a SampleBackgroundTaskWithCondition.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RegisterBackgroundTask(object sender, RoutedEventArgs e)
        {
            var task = BackgroundTaskSample.RegisterBackgroundTask(BackgroundTaskSample.SampleBackgroundTaskEntryPoint,
                                                                   BackgroundTaskSample.SampleBackgroundTaskWithConditionName,
                                                                   new SystemTrigger(SystemTriggerType.TimeZoneChange, false),
                                                                   new SystemCondition(SystemConditionType.InternetAvailable));

            AttachProgressAndCompletedHandlers(task);
            UpdateUI();
        }
        /// <summary>
        /// Register a ServicingCompleteTask.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RegisterBackgroundTask(object sender, RoutedEventArgs e)
        {
            var task = BackgroundTaskSample.RegisterBackgroundTask(BackgroundTaskSample.ServicingCompleteTaskEntryPoint,
                                                                   BackgroundTaskSample.ServicingCompleteTaskName,
                                                                   new SystemTrigger(SystemTriggerType.ServicingComplete, false),
                                                                   null);

            AttachProgressAndCompletedHandlers(task);
            UpdateUI();
        }
        /// <summary>
        /// Register a SampleBackgroundTask.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void RegisterBackgroundTask(object sender, RoutedEventArgs e)
        {
            var task = BackgroundTaskSample.RegisterBackgroundTask(BackgroundTaskSample.SampleBackgroundTaskEntryPoint,
                                                                   BackgroundTaskSample.SampleBackgroundTaskName,
                                                                   new SystemTrigger(SystemTriggerType.TimeZoneChange, false),
                                                                   null);
            await task;

            AttachProgressAndCompletedHandlers(task.Result);
            UpdateUI();
        }
        /// <summary>
        /// Register a ApplicationTriggerTask.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void RegisterBackgroundTask(object sender, RoutedEventArgs e)
        {
            trigger = new ApplicationTrigger();

            var task = BackgroundTaskSample.RegisterBackgroundTask(BackgroundTaskSample.SampleBackgroundTaskEntryPoint,
                                                                   BackgroundTaskSample.ApplicationTriggerTaskName,
                                                                   trigger,
                                                                   null);
            await task;

            AttachProgressAndCompletedHandlers(task.Result);
            UpdateUI();
        }
        /// <summary>
        /// Register a TimeTriggeredTask.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void RegisterBackgroundTask(object sender, RoutedEventArgs e)
        {
            //
            // Time triggered tasks can only run when the application is on the lock screen.
            // Time triggered tasks can be registered even if the application is not on the lockscreen.
            //
            await BackgroundExecutionManager.RequestAccessAsync();

            var task = BackgroundTaskSample.RegisterBackgroundTask(BackgroundTaskSample.SampleBackgroundTaskEntryPoint,
                                                                   BackgroundTaskSample.TimeTriggeredTaskName,
                                                                   new TimeTrigger(15, false),
                                                                   null);

            AttachProgressAndCompletedHandlers(task);
            UpdateUI();
        }