示例#1
0
        public static void UpdateStatusConsecutively(Task task)
        {
            Timer timer = null;

            timer = TimerUtils.CreateTimer(() =>

                                           TaskActions.UpdateStatusForConsecutiveTask(timer, task), 3000, 3000);

            var taskTimer = TimerUtils.AddTimer(timer, task.Name, "Consecutive Checker Timer", 3000, 3000);
        }
示例#2
0
        public static void UpdateStatusForLoaded(Task task)
        {
            Timer timer = null;

            timer = TimerUtils.CreateTimer(() =>

                                           TaskActions.UpdateForLoadedTask(timer, task), 3000, 3000);

            var taskTimer = TimerUtils.AddTimer(timer, task.Name, "Loaded Task Updater", 3000, 3000);
        }
示例#3
0
        public static void UpdateStatusEverySeconds(Task task)
        {
            Timer timer = null;

            timer = TimerUtils.CreateTimer(() =>

                                           TaskActions.UpdateTasksRunningStatus(timer, task), 3000, 3000);

            TimerUtils.AddTimer(timer, task.Name, "Task Status Updater", 3000, 3000);
        }
示例#4
0
        public static void SetTaskStartingTimer(Task task)
        {
            var dueTime = TimeSpanUtils.GetMillisecondsFromNow(task.Period.StartDate);

            Timer timer = null;

            timer = TimerUtils.CreateTimer(() =>

                                           TaskActions.StartTaskThenDisposeTimer(timer, task), dueTime, Timeout.Infinite);

            var taskTimer = TimerUtils.AddTimer(timer, task.Name, "Task Starting Timer", dueTime, -1);
        }
示例#5
0
        public static void RunTaskPeriodically(Task task)
        {
            var dueTime = TimeSpan.Zero;
            var period  = task.Period.TimeBetween;

            System.Threading.Timer timer = null;

            timer = TimerUtils.CreateTimer(() =>

                                           TaskActions.RunTaskDisposeIfNull(timer, task), dueTime, period);

            var taskTimer = TimerUtils.AddTimer(timer, task.Name, "Periodical Runner Timer", dueTime, period);

            logger.Info($"{taskTimer} is added.");
        }
示例#6
0
        public static void StartDelayForConsecutive(Task task)
        {
            var startConsecutivelyValue = (float)form.StartConsecutivelyDelay.Value;

            var delay = (long)
                        TimeSpanUtils
                        .GenerateTimeSpan(startConsecutivelyValue, IntervalUtils.GetInterval())
                        .TotalMilliseconds;

            Timer timer = null;

            TimerUtils.CreateTimer(() =>

                                   TaskActions.RunTaskUpdateTaskDisposeTimer(timer, task), delay, Timeout.Infinite);

            var taskTimer = TimerUtils.AddTimer(timer, task.Name, "Consecutive Delayer Timer", delay, -1);
        }