public static void StartTaskThenDisposeTimer(Timer timer, Task task) { if (!TaskUtils.IsNull(task)) { TaskStarter.StartTaskAccordingly(task); } TimerUtils.DisposeTimer(timer); }
public static void UpdateForLoadedTask(Timer timer, Task task) { if (TaskUtils.IsNull(task)) { TimerUtils.DisposeTimer(timer); return; } TaskUpdater.UpdateTask(task); }
public static void UpdateTasksRunningStatus(Timer timer, Task task) { if (TaskUtils.IsNull(task)) { TimerUtils.DisposeTimer(timer); return; } TaskUpdater.UpdateTask(task); }
public static void RunTaskDisposeIfNull(Timer timer, Task task) { if (TaskUtils.IsNull(task)) { TimerUtils.DisposeTimer(timer); return; } TaskRunner.RunTask(task); }
public static void UpdateStatusForConsecutiveTask(Timer timer, Task task) { if (TaskUtils.IsNull(task)) { TimerUtils.DisposeTimer(timer); return; } if (!TaskRunner.IsTaskRunning(task)) { TaskUtils.StartDelayForConsecutive(task); TimerUtils.DisposeTimer(timer); } }
private static void StartNotificationTimer(Task task) { if (task.EmailInfo == null) { return; } var taskStartingDate = task.Period.StartDate; var dontRunLongerThanValue = MainForm.Form.GetDontRunLongerThanValue(); bool tryToSend = false; System.Threading.Timer timer = null; timer = new System.Threading.Timer((e) => { if (TaskUtils.IsNull(task)) { TimerUtils.DisposeTimer(timer); return; } if (TimeSpanUtils .GetDifference(DateTime.Now, taskStartingDate) > dontRunLongerThanValue) { if (!tryToSend && TaskRunner.IsTaskRunning(task)) { tryToSend = true; EmailUtils.RedirectToSendEmail(task.Name, dontRunLongerThanValue); } TimerUtils.DisposeTimer(timer); } }, null, 0, 3000); var taskTimer = TimerUtils.AddTimer(timer, task.Name, "Notification Timer", 0, 3000); logger.Info($"{taskTimer} is added."); }
public static void RunTaskUpdateForConsecutiveDisposeTimer(Timer timer, Task task) { TaskRunner.RunTask(task); TaskUpdater.UpdateStatusConsecutively(task); TimerUtils.DisposeTimer(timer); }