Пример #1
0
 private void FireQueueNotification(QueueEventArgs args)
 {
     if (this.QueueNotification != null)
     {
         QueueNotification(this, args);
     }
 }
Пример #2
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);
 }
Пример #3
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);
     }
 }