예제 #1
0
        public Manager(string user_id, int iteration, int[] degreeList,string taskDesc, string labelLeftMost, string labelRightMost, ArduinoUno arduinouno,TaskDisplay tDisplay)
        {
            logPath = "log_" + user_id + ".csv";
            this.user_id = user_id;
            arduino = arduinouno;
            Manager.tDisplay = tDisplay;
            tDisplay.buttonOK.Click += buttonOK_Click;

            taskQueue = new Queue<Task>();
            curTask = null;

            List<Task> taskList = new List<Task>();
            for (int i = 0; i < iteration; i++)
            {
                for (int j = 0; j < degreeList.Length; j++)
                {
                    taskList.Add(new Task(degreeList[j],taskDesc,labelLeftMost,labelRightMost));
                }
            }
            Shuffle(taskList);

            int id = 1;
            foreach (Task t in taskList)
            {
                t.Id = id;
                taskQueue.Enqueue(t);
                id++;
            }
            taskList.Clear();
            taskList = null;
        }
예제 #2
0
 public bool StartNextTask()
 {
     if (taskQueue.Count == 0)
     {
         return false;
     }
     curTask = taskQueue.Dequeue();
     curTask.GetReady();
     return true;
 }