Beispiel #1
0
        public static void StopSchedule(SchedulerJob schedule)
        {
            Dictionary <int, BackgroundTask> scheduledTasks = TaskManager.GetScheduledTasks();

            if (!scheduledTasks.ContainsKey(schedule.ScheduleInfo.ScheduleId))
            {
                return;
            }

            BackgroundTask activeTask = scheduledTasks[schedule.ScheduleInfo.ScheduleId];

            TaskManager.StopTask(activeTask.TaskId);
        }
Beispiel #2
0
        private static void RunManualTasks()
        {
            var tasks = TaskController.GetProcessTasks(BackgroundTaskStatus.Stopping);

            foreach (var task in tasks)
            {
                TaskManager.StopTask(task.TaskId);
            }

            tasks = TaskController.GetProcessTasks(BackgroundTaskStatus.Starting);

            foreach (var task in tasks)
            {
                var taskThread = new Thread(() => RunBackgroundTask(task))
                {
                    Priority = ThreadPriority.Highest
                };
                taskThread.Start();
                TaskManager.AddTaskThread(task.Id, taskThread);
            }
        }
Beispiel #3
0
 public void StopTask(string taskId)
 {
     TaskManager.StopTask(taskId);
 }