A task to be executed by the Scheduler. Stores timing information and state.
Exemple #1
0
 /// <summary> Schedules a given task for execution. </summary>
 /// <param name="task"> Task to schedule. </param>
 internal static void AddTask(SchedulerTask task)
 {
     if (task == null) throw new ArgumentNullException("task");
     lock (TaskListLock)
     {
         task.IsStopped = false;
     #if DEBUG_SCHEDULER
         FireEvent( TaskAdded, task );
         if( Tasks.Add( task ) ) {
             UpdateCache();
             Logger.Log( LogType.Debug,
                         "Scheduler.AddTask: Added {0}", task );
         }else{
             Logger.Log( LogType.Debug,
                         "Scheduler.AddTask: Added duplicate {0}", task );
         }
     #else
         if (Tasks.Add(task))
         {
             UpdateCache();
         }
     #endif
     }
 }
Exemple #2
0
 static void FireEvent( EventHandler<SchedulerTaskEventArgs> eventToFire, SchedulerTask task )
 {
     var h = eventToFire;
     if( h != null ) h( null, new SchedulerTaskEventArgs( task ) );
 }
 public SchedulerTaskEventArgs( SchedulerTask task )
 {
     Task = task;
 }