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)); } }
public TaskScheduleThread(ITaskSchedule taskSchedule) : base() { if (taskSchedule == null || taskSchedule.TaskOperation == null) { throw new Exception("初始化失败!"); } _taskSchedule = taskSchedule; _logger = EngineCommon.Logger; initTaskSchedule(); }
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); }