public void AddTaskToTaskWaitList(Task Tsk) { //--- Check task can run or exists in the task wait list if (Tsk.CanRun() ? TaskWaitList.Contains(Tsk) : true) { return; } //--- Add the task to the task wait list TaskWaitList.Add(Tsk); }
public void RunNextTask() { //--- Check task in task wait list exists if (TaskWaitList.Count == 0) { return; } //--- Step the task timer TaskTimer.Stop(); //--- Get and remove the first task of the task wait list RunningTask = TaskWaitList[0]; TaskWaitList.RemoveAt(0); //--- Run the task and clear the running task RunningTask.Run(); RunningTask = null; //--- Start the task timer TaskTimer.Start(); }