AddTask() static private method

Schedules a given task for execution.
static private AddTask ( [ task ) : void
task [ Task to schedule.
return void
Beispiel #1
0
 SchedulerTask RunForever()
 {
     IsRecurring = true;
     NextTime    = DateTime.UtcNow.Add(Delay);
     Scheduler.AddTask(this);
     return(this);
 }
Beispiel #2
0
 /// <summary> Runs the task once, as quickly as possible.
 /// Callback is invoked from the Scheduler thread. </summary>
 public SchedulerTask RunOnce()
 {
     NextTime    = DateTime.UtcNow.Add(Delay);
     IsRecurring = false;
     Scheduler.AddTask(this);
     return(this);
 }
Beispiel #3
0
 /// <summary> Runs the task once at a given date.
 /// If the given date is in the past, the task is ran immediately. </summary>
 public SchedulerTask RunOnce(DateTime time)
 {
     Delay       = time.Subtract(DateTime.UtcNow);
     NextTime    = time;
     IsRecurring = false;
     Scheduler.AddTask(this);
     return(this);
 }
Beispiel #4
0
 /// <summary> Executes the task once at a given time, and suspends (but does not stop).
 /// A SchedulerTask object can be reused many times if ran manually. </summary>
 public SchedulerTask RunManual(DateTime time)
 {
     Delay       = time.Subtract(DateTime.UtcNow);
     IsRecurring = true;
     NextTime    = time;
     MaxRepeats  = -1;
     Interval    = CloseEnoughToForever;
     Scheduler.AddTask(this);
     return(this);
 }
Beispiel #5
0
 /// <summary> Executes the task once after a delay, and suspends (but does not stop).
 /// A SchedulerTask object can be reused many times if ran manually. </summary>
 public SchedulerTask RunManual(TimeSpan delay)
 {
     Delay       = delay;
     IsRecurring = true;
     NextTime    = DateTime.UtcNow.Add(Delay);
     MaxRepeats  = -1;
     Interval    = CloseEnoughToForever;
     Scheduler.AddTask(this);
     return(this);
 }