Beispiel #1
0
 private void ExecuteTask()
 {
     mainThread = new Thread(() =>
     {
         do
         {
             if (ReadyTasks.Count <= MAX_VALUE)
             {
                 for (int i = ReadyTasks.Count; i < MAX_VALUE; i++)
                 {
                     if (StoreTasks.Count != 0)
                     {
                         ReadyTasks.Enqueue(StoreTasks.Peek());
                         StoreTasks.Dequeue();
                     }
                 }
             }
             if (ReadyTasks.Count > 0)
             {
                 Taskandler executeHandler = ReadyTasks.Peek();
                 UserTask u = executeHandler.UserTask;
                 thread     = new Thread(new ThreadStart(u));
                 thread.Start();
                 ReadyTasks.Dequeue();
                 thread.Join();
                 EventDataBase.TriggerEvent("PRINT_LABEL");
                 CommandState.Command commamd = CommandState.Instance.GetCommand();
             }
         } while (true);
     });
     mainThread.Start();
 }
Beispiel #2
0
 public string GetHistoryItem(bool down)
 {
     if (prevSelected == -1)
     {
         selectedHistoryItem = historyLength;
     }
     else
     {
         selectedHistoryItem = prevSelected;
     }
     if (down)
     {
         if (prevSelected == -1)
         {
             EventDataBase.TriggerEvent("PRINT_LABEL");
             return(null);
         }
         else
         {
             selectedHistoryItem = prevSelected + 1;
             if (selectedHistoryItem >= historyLength)
             {
                 prevSelected        = -1;
                 selectedHistoryItem = historyLength;
                 return("");
             }
             prevSelected = selectedHistoryItem;
             return(history[selectedHistoryItem]);
         }
     }
     else
     {
         selectedHistoryItem--;
         prevSelected = selectedHistoryItem;
         if (selectedHistoryItem == -1)
         {
             selectedHistoryItem = 0;
             prevSelected        = 0;
             return(history[selectedHistoryItem]);
         }
         else
         {
             return(history[selectedHistoryItem]);
         }
     }
 }