Exemplo n.º 1
0
        public EventQueueProcessor(EventQueue eventQueueIncoming, EventQueueCollection eventQueueOutgoing, TimeoutManager timeoutManager)
        {
            this.eventQueueIncoming = eventQueueIncoming;
            this.eventQueueOutgoing = eventQueueOutgoing;

            this.messageBoxOutgoingflags = new Dictionary<string, bool>();
            this.messageBoxIncomingFlag = false;

            this.timeoutManager = timeoutManager;
        }
        public void Enqueue(string address, NetworkObject networkObject, int due = 0)
        {
            System.Diagnostics.Debug.WriteLine("ENQUEUE OUTGOING: " + address);

            EventQueue queue;
            if (this.messageQueue.TryGetValue(address, out queue))
                queue.Enqueue(address, networkObject, due);
            else
            {
                queue = new EventQueue();
                queue.Enqueue(address, networkObject, due);
                messageQueue.Add(address, queue);
            }

            if (this.eventEnqueuedCallback != null)
                this.eventEnqueuedCallback(address);
        }