/// <summary> /// Handles processing of due tasks. Sends out a message that a task is due, updates the tasks properties and /// removes the task if it was scheduled to run only once. This method gets called from the DoWork() method. /// </summary> /// <param name="task">Task to process.</param> private void ProcessTask(Task task) { Task tc = (Task) task.Clone(); TaskSchedulerMessaging.SendTaskSchedulerMessage(TaskSchedulerMessaging.MessageType.DUE, tc); task.LastRun = task.NextRun; if (task.Occurrence == Occurrence.Once) { _settings.TaskCollection.Remove(task); TaskSchedulerMessaging.SendTaskSchedulerMessage(TaskSchedulerMessaging.MessageType.DELETED, tc); } }
/// <summary> /// Handles processing of due tasks. Sends out a message that a task is due, updates the tasks properties and /// removes the task if it was scheduled to run only once. This method gets called from the DoWork() method. /// </summary> /// <param name="task">Task to process.</param> private void ProcessTask(Task task) { ServiceRegistration.Get<ILogger>().Debug("TaskScheduler: ProcessTask: {0}", task.ToString()); Task tc = (Task) task.Clone(); TaskSchedulerMessaging.SendTaskSchedulerMessage(TaskSchedulerMessaging.MessageType.DUE, tc); task.LastRun = task.NextRun; if (task.Occurrence == Occurrence.Once) { _settings.TaskCollection.Remove(task); TaskSchedulerMessaging.SendTaskSchedulerMessage(TaskSchedulerMessaging.MessageType.DELETED, tc); } }
/// <summary> /// Handles expired tasks: Sends out a message that a particular task is expired, removes the task from the /// registered task collection and sends out a message that the task is deleted. This method gets called /// from the DoWork() method. /// </summary> /// <param name="task">Task to expire</param> private void ExpireTask(Task task) { Task tc = (Task) task.Clone(); TaskSchedulerMessaging.SendTaskSchedulerMessage(TaskSchedulerMessaging.MessageType.EXPIRED, tc); _settings.TaskCollection.Remove(task); TaskSchedulerMessaging.SendTaskSchedulerMessage(TaskSchedulerMessaging.MessageType.DELETED, tc); SaveChanges(false); }
/// <summary> /// Handles expired tasks: Sends out a message that a particular task is expired, removes the task from the /// registered task collection and sends out a message that the task is deleted. This method gets called /// from the DoWork() method. /// </summary> /// <param name="task">Task to expire</param> private void ExpireTask(Task task) { ServiceRegistration.Get<ILogger>().Debug("TaskScheduler: ExpireTask: {0}", task.ToString()); Task tc = (Task) task.Clone(); TaskSchedulerMessaging.SendTaskSchedulerMessage(TaskSchedulerMessaging.MessageType.EXPIRED, tc); _settings.TaskCollection.Remove(task); TaskSchedulerMessaging.SendTaskSchedulerMessage(TaskSchedulerMessaging.MessageType.DELETED, tc); SaveChanges(false); }