Пример #1
0
 private void RegisterBackgroundTask(object sender, RoutedEventArgs e)
 {
     trigger = new ApplicationTrigger();
     var task = SchedulerConfigurations.RegisterBackgroundTask(LocalDataStore.BackgroundTaskEntryPoint,
                                                               LocalDataStore.BackgroundTriggerName,
                                                               trigger,
                                                               null);
     // AttachProgressAndCompletedHandlers(task);
     //SignalBackgroundTask(null, null);
     // UpdateUI();
 }
Пример #2
0
        public void RegisterTask()
        {
            runCount++;
            Debug.WriteLine("............................................................................................Datetime : " + DateTime.Now + " in RegisterTask ...............Run Count : " + runCount);
            taskTrigger = new ApplicationTrigger();
            var task = SchedulerConfigurations.RegisterBackgroundTask(LocalDataStore.BackgroundTaskEntryPoint,
                                                                      LocalDataStore.BackgroundTriggerName,
                                                                      taskTrigger,
                                                                      null);

            // taskRunning = true;
            StartBackgroundTask();
        }
Пример #3
0
        private void UnRegisterTask()
        {
            Debug.WriteLine("............................................................................................Datetime : " + DateTime.Now + " in UnRegisterTask");
            SchedulerConfigurations.UnregisterBackgroundTasks(LocalDataStore.BackgroundTriggerName);
            //taskRunning = false;

            Debug.WriteLine("********************************************************************************************New Schedule time at :" + DateTime.Now.AddMinutes(2).TimeOfDay.ToString());
            ApplicationDataContainer localSettings1;

            localSettings1 = ApplicationData.Current.LocalSettings;
            localSettings1.Values["SchedulerStartTime"] = new TimeSpan(DateTime.Now.Hour, DateTime.Now.AddMinutes(2).Minute, 0);
            localSettings1.Values["SchedulerEndTime"]   = new TimeSpan(DateTime.Now.Hour, DateTime.Now.AddMinutes(4).Minute, 0);
        }
Пример #4
0
 /// <summary>
 /// Unregister a ApplicationTriggerTask.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void UnregisterBackgroundTask(object sender, RoutedEventArgs e)
 {
     SchedulerConfigurations.UnregisterBackgroundTasks(LocalDataStore.BackgroundTriggerName);
 }