Ejemplo n.º 1
0
 public void AddTask(ITaskSchedule taskSchedule)
 {
     if (taskSchedule == null || taskSchedule.TaskOperation == null)
     {
         return;
     }
     if (!Tasks.ContainsKey(taskSchedule.TaskOperation.Name))
     {
         Tasks.TryAdd(taskSchedule.TaskOperation.Name, new TaskScheduleThread(taskSchedule));
     }
 }
Ejemplo n.º 2
0
 public TaskScheduleThread(ITaskSchedule taskSchedule)
     : base()
 {
     if (taskSchedule == null || taskSchedule.TaskOperation == null)
     {
         throw new Exception("初始化失败!");
     }
     _taskSchedule = taskSchedule;
     _logger       = EngineCommon.Logger;
     initTaskSchedule();
 }
Ejemplo n.º 3
0
        public static cType FromScheduleToType <cType>(ITaskSchedule source) where cType : TaskSchedule <T>, new()
        {
            cType copy = new cType();

            copy.EarliestStart  = source.EarliestStart;
            copy.EarliestFinish = source.EarliestFinish;
            copy.LatestStart    = source.LatestStart;
            copy.LatestFinish   = source.LatestFinish;

            copy.ScheduledStart  = source.ScheduledStart;
            copy.ScheduledFinish = source.ScheduledFinish;

            copy.TargetDuration = TimeFrame.FromSeconds(source.TargetDuration.AsSeconds);
            foreach (var timePeriod in source.AbsoluteActiveTimes)
            {
                copy.AbsoluteActiveTimes.Add(timePeriod);
            }

            return(copy);
        }