public ScheduleTask RegisterTask(string name, DispatcherPriority priority, ScheduleTask.NoArgumentsReturningVoid updateHandler, string[] dependencyNames) { ScheduleTask scheduleTask1 = new ScheduleTask(this, name, priority, updateHandler); if (this.taskDictionary.ContainsKey(scheduleTask1.Name)) { throw new ArgumentException(ExceptionStringTable.CantRegisterTwoTasksWithSameName); } if (dependencyNames != null) { foreach (string key in dependencyNames) { if (!this.taskDictionary.ContainsKey(key)) { throw new ArgumentException(ExceptionStringTable.CantRegisterADependencyOnANonexistentTask); } if (this.taskDictionary[key].Priority < scheduleTask1.Priority) { throw new ArgumentException(ExceptionStringTable.CantRegisterADependencyOnATaskAtALowerPriorityThanYourself); } } foreach (string index in dependencyNames) { ScheduleTask scheduleTask2 = this.taskDictionary[index]; scheduleTask1.Dependencies.Add(scheduleTask2); scheduleTask2.ReverseDependencies.Add(scheduleTask1); } } this.taskDictionary.Add(scheduleTask1.Name, scheduleTask1); this.taskList.Add(scheduleTask1); return(scheduleTask1); }
internal ScheduleTask(SchedulingService scheduleService, string name, DispatcherPriority priority, ScheduleTask.NoArgumentsReturningVoid updateHandler) { this.scheduleService = scheduleService; this.name = name; this.priority = priority; this.updateHandler = updateHandler; }