예제 #1
0
 /// <summary>
 /// If commands are found in the queue it sends commands and removes processed commands from queue
 /// </summary>
 private void ProcessCommand()
 {
     // Check if we have any commands in the queue to process.
     if (queue.Count > 0)
     {
         Cm11Message command = queue.Peek();
         if (command != null)
         {
             // Try to send command to CM11 device
             try
             {
                 if (Send(command.Buffer, command.Count))
                 {
                     if (SendOk())
                     {
                         lock (queuePadLock)
                         {
                             queue.Dequeue();
                         }
                     }
                 }
             }
             catch (System.TimeoutException)
             {
                 RaiseErrorEvent(new Cm11LowLevelDriverError("Sending command to CM11 interace failed. Is the CM11 interface still plugged in to the AC outlet?"));
             }
         }
     }
 }
예제 #2
0
        public void Tick(float time, Action <TimedBeatId> discardBeat)
        {
            var timeLimit = time - keepWindow;

            while (times.Count > 0 && times.Peek().T < timeLimit)
            {
                discardBeat(times.Dequeue());
            }
        }
예제 #3
0
 void Update()
 {
     if (sQueueMsg.Count > 0)
     {
         string msg = sQueueMsg.Peek();
         sQueueMsg.Dequeue();
         LogMgr.Log(msg);
     }
 }
예제 #4
0
 private bool CanLoadNextABAsyn()
 {
     if ((waitingABPath.Count > 0) &&
         (CurAsynLoadingAbNum < MAX_ASYN_LOADAB_NUM_PER))
     {
         string nextAb = waitingABPath.Peek();
         if (IsDependenceLoadComplete(nextAb))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #5
0
        public void Task_Show_TheFirstElement_Test()
        {
            //Arrange
            System.Collections.Generic.Queue <object> TestQueue = new System.Collections.Generic.Queue <object>();
            TestQueue.Enqueue(1);
            TestQueue.Enqueue(2);
            TestQueue.Enqueue(3);
            MyLibrary.Queue <object> MyQueue = new MyLibrary.Queue <object>();
            MyQueue.Enqueue(1);
            MyQueue.Enqueue(2);
            MyQueue.Enqueue(3);
            //Act
            object firstitem = TestQueue.Peek();
            object firstelem = MyQueue.PeekFirst;

            //Assert
            Assert.Equal(firstitem, firstelem);
        }
예제 #6
0
 public IValue Peek()
 {
     return(_queue.Peek());
 }