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); }
public static TimeSpan GetTimeBetween(StartProperty prop) { float every; Interval interval; if (prop == StartProperty.Periodically) { every = (float)MainForm.Form.StartPeriodicallyEvery.Value; interval = IntervalUtils.GetInterval(); } else { every = (float)MainForm.Form.StartConsecutivelyDelay.Value; interval = IntervalUtils.GetInterval(); } return(TimeSpanUtils.GenerateTimeSpan(every, interval)); }