Example #1
0
 public bool TryDequeue(string queueId, out Visitor visitor)
 {
     if (CarQueues.TryGetValue(queueId, out CarQueue queue))
     {
         if (queue.TryDequeue(out visitor))
         {
             FireQueueNotification(QueueEventArgs.Create(queueId, visitor, queue.Type, QueueOperation.Dequeue));
             return(true);
         }
     }
     visitor = null;
     return(false);
 }
Example #2
0
 public bool TryEnqueue(string queueId, Visitor visitor)
 {
     try
     {
         if (!CarQueues.TryGetValue(queueId, out CarQueue queue))
         {
             throw new QueueException();
         }
         queue.Enqueue(visitor);
         FireQueueNotification(QueueEventArgs.Create(queueId, visitor, queue.Type, QueueOperation.Enqueue));
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }