Exemplo n.º 1
0
        public async void Create(string backgroundTaskName, string backgroundTaskEntryPoint, int time, IBackgroundCondition backgroundCondition)
        {
            IBackgroundTrigger backgroundTrigger = new TimeTrigger((uint)time, false);
            var   task = BackgroundTaskHelper.RegisterBackgroundTask(backgroundTaskEntryPoint, backgroundTaskName, backgroundTrigger, backgroundCondition);
            await task;

            AttachProgressAndCompletedHandlers(task.Result);
        }
Exemplo n.º 2
0
 private async Task RegisterBackgroundTask()
 {
     var task = await BackgroundTaskHelper.RegisterBackgroundTask(
         typeof(Sodu.CheckUpdateTask.BookShelfCheckTask),
         "BookShelfCheckTask",
         new TimeTrigger(120, false),
         null);
 }
Exemplo n.º 3
0
        public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
        {
            // register background tasks
            // background task to update next lesson in tile
            BackgroundTaskHelper.RegisterBackgroundTask("TimetableBackgroundTask", "BackgroundTasks.TimetableBackgroundTask", 15);

            NavigationService.Navigate(typeof(Views.TimetablePage));
            await Task.CompletedTask;
        }
Exemplo n.º 4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var task = BackgroundTaskHelper.RegisterBackgroundTask(taskEntryPoint: "Tasks.OutOfProcessBgTask",
                                                                   taskName: "OutOfProcessBgTask",
                                                                   trigger: new MaintenanceTrigger(freshnessTime: 15, oneShot: false),
                                                                   condition: new SystemCondition(SystemConditionType.InternetAvailable));

            AttachProgressAndCompletedHandlers(task);
        }
Exemplo n.º 5
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (LocalSettingHelper.GetValue("EnableBackgroundTask") == "true")
            {
                BackgroundTaskHelper.RegisterBackgroundTask(DeviceKind.Windows);
            }

            Frame.BackStack.Clear();
        }
        //Register background task when checkbox checked
        private async void CbxNetworkChange_OnChecked(object sender, RoutedEventArgs e)
        {
            var task = BackgroundTaskHelper.RegisterBackgroundTask(BackgroundTaskHelper.BackgroundTaskEntryPoint,
                                                                   BackgroundTaskHelper.BackgroundTaskName,
                                                                   new SystemTrigger(SystemTriggerType.NetworkStateChange, false),
                                                                   null);

            await task;

            task.Result.Completed += Result_Completed;
            UpdateUI();
        }
Exemplo n.º 7
0
        private void SwitchToggleGradesNotification_Toggled(object sender, RoutedEventArgs e)
        {
            ToggleSwitch toggleSwitch = (ToggleSwitch)sender;

            if (toggleSwitch.IsOn)
            {
                BackgroundTaskHelper.RegisterBackgroundTask("GradesBackgroundTask", "BackgroundTasks.GradesBackgroundTask", 60);
            }
            else
            {
                BackgroundTaskHelper.UnregisterBackgroundTask("GradesBackgroundTask");
            }
        }