Beispiel #1
0
        public void PushTask(string name, Action doAction, TimeSpan executeTime)
        {
            ScheduleTask task = new ScheduleTask(name, executeTime, delegate(ScheduleTask sender, object data)
            {
                try
                {
                    doAction();
                }
                finally
                {
                    sender.IntervalMilliseconds = (long)CalcInterval((TimeSpan)data);
                }
            }, (int)CalcInterval(executeTime));

            PushTask(task);
        }
Beispiel #2
0
 public void PushTask(ScheduleTask task, bool executeImmediately)
 {
     task.Owner = this;
     if (!executeImmediately)
     {
         task.CalcNewExecuteTime();
     }
     lock (_tasks)
     {
         if (_tasks.ContainsKey(task.Name))
         {
             throw new Exception("The schedule task '" + task.Name + "' exists!");
         }
         _tasks.Add(task.Name, task);
     }
     ResetTimer();
 }
Beispiel #3
0
 public ScheduleTaskExceptionEventArgs(Exception ex, ScheduleTask task)
 {
     Error = ex;
     Task = task;
 }
Beispiel #4
0
        public void PushTask(string name, Action doAction, TimeSpan executeTime)
        {
            ScheduleTask task = new ScheduleTask(name, executeTime, delegate(ScheduleTask sender, object data)
            {

                try
                {
                    doAction();
                }
                finally
                {
                    sender.IntervalMilliseconds = (long)CalcInterval((TimeSpan)data);
                }
            }, (int)CalcInterval(executeTime));
            PushTask(task);
        }
Beispiel #5
0
 public void PushTask(ScheduleTask task, bool executeImmediately)
 {
     task.Owner = this;
     if (!executeImmediately)
     {
         task.CalcNewExecuteTime();
     }
     lock (_tasks)
     {
         if (_tasks.ContainsKey(task.Name))
         {
             throw new Exception("The schedule task '" + task.Name + "' exists!");
         }
         _tasks.Add(task.Name, task);
     }
     ResetTimer();
 }
Beispiel #6
0
 public void PushTask(ScheduleTask task)
 {
     PushTask(task, false);
 }
Beispiel #7
0
 public void PushTask(ScheduleTask task)
 {
     PushTask(task, false);
 }
Beispiel #8
0
 public ScheduleTaskExceptionEventArgs(Exception ex, ScheduleTask task)
 {
     Error = ex;
     Task  = task;
 }
Beispiel #9
0
 public static void PushTask(ScheduleTask task, bool executeImmediately)
 {
     _scheduler.PushTask(task, executeImmediately);
 }
Beispiel #10
0
 public static void PushTask(ScheduleTask task)
 {
     _scheduler.PushTask(task);
 }
Beispiel #11
0
 public static void PushTask(ScheduleTask task, bool executeImmediately)
 {
     _scheduler.PushTask(task, executeImmediately);
 }
Beispiel #12
0
 public static void PushTask(ScheduleTask task)
 {
     _scheduler.PushTask(task);
 }