Exemplo n.º 1
0
 /// <summary>
 /// Unregisters all Background Tasks that are not in groups.
 /// This will not impact tasks registered with groups.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void UnregisterUngroupedTasks(object sender, RoutedEventArgs e)
 {
     foreach (var cur in BackgroundTaskRegistration.AllTasks)
     {
         cur.Value.Unregister(true);
         BackgroundTaskSample.UpdateBackgroundTaskRegistrationStatus(cur.Value.Name, false);
     }
 }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            foreach (var task in BackgroundTaskRegistration.AllTasks)
            {
                if (task.Value.Name == BackgroundTaskSample.SampleBackgroundTaskWithConditionName)
                {
                    AttachProgressAndCompletedHandlers(task.Value);
                    BackgroundTaskSample.UpdateBackgroundTaskRegistrationStatus(BackgroundTaskSample.SampleBackgroundTaskWithConditionName, true);
                    break;
                }
            }

            UpdateUI();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            foreach (var task in BackgroundTaskRegistration.AllTasks)
            {
                if (task.Value.Name == BackgroundTaskSample.ApplicationTriggerTaskName)
                {
                    AttachProgressAndCompletedHandlers(task.Value);
                    BackgroundTaskSample.UpdateBackgroundTaskRegistrationStatus(BackgroundTaskSample.ApplicationTriggerTaskName, true);
                    break;
                }
            }

            trigger = new ApplicationTrigger();
            UpdateUI();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            group = BackgroundTaskSample.GetTaskGroup(BackgroundTaskSample.BackgroundTaskGroupId, BackgroundTaskSample.BackgroundTaskGroupFriendlyName);

            foreach (var task in group.AllTasks)
            {
                if (task.Value.Name == BackgroundTaskSample.GroupedBackgroundTaskName)
                {
                    AttachProgressAndCompletedHandlers(task.Value);
                    BackgroundTaskSample.UpdateBackgroundTaskRegistrationStatus(BackgroundTaskSample.GroupedBackgroundTaskName, true);
                    break;
                }
            }

            UpdateUI();
        }