/// <summary> /// Initializes the task manager with the property values specified in the configuration file. /// </summary> public void Initialize() { this._taskThreads.Clear(); var scheduleTasks = UserFunctions.GetReportTasks(); //group by threads with the same seconds foreach (var scheduleTaskGrouped in scheduleTasks.GroupBy(x => x.Seconds)) { //create a thread var taskThread = new TaskThread() { Seconds = scheduleTaskGrouped.Key }; foreach (var scheduleTask in scheduleTaskGrouped) { var task = new Task(scheduleTask); taskThread.AddTask(task); } this._taskThreads.Add(taskThread); } }