private void FireQueueNotification(QueueEventArgs args) { if (this.QueueNotification != null) { QueueNotification(this, args); } }
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); }
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); } }