Ejemplo n.º 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);
        }
Ejemplo n.º 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();
 }
Ejemplo n.º 3
0
 public ScheduleTaskExceptionEventArgs(Exception ex, ScheduleTask task)
 {
     Error = ex;
     Task = task;
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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();
 }
Ejemplo n.º 6
0
 public void PushTask(ScheduleTask task)
 {
     PushTask(task, false);
 }
Ejemplo n.º 7
0
 public void PushTask(ScheduleTask task)
 {
     PushTask(task, false);
 }
Ejemplo n.º 8
0
 public ScheduleTaskExceptionEventArgs(Exception ex, ScheduleTask task)
 {
     Error = ex;
     Task  = task;
 }
Ejemplo n.º 9
0
 public static void PushTask(ScheduleTask task, bool executeImmediately)
 {
     _scheduler.PushTask(task, executeImmediately);
 }
Ejemplo n.º 10
0
 public static void PushTask(ScheduleTask task)
 {
     _scheduler.PushTask(task);
 }
Ejemplo n.º 11
0
 public static void PushTask(ScheduleTask task, bool executeImmediately)
 {
     _scheduler.PushTask(task, executeImmediately);
 }
Ejemplo n.º 12
0
 public static void PushTask(ScheduleTask task)
 {
     _scheduler.PushTask(task);
 }