Пример #1
0
        public void AddEventListener(IPsdzEventListener psdzEventListener)
        {
            if (psdzEventListener == null)
            {
                return;
            }
            IDictionary <IPsdzEventListener, PsdzEventService.PsdzEventListenerClient> obj = this.eventListenerClients;

            lock (obj)
            {
                if (!this.eventListenerClients.ContainsKey(psdzEventListener))
                {
                    PsdzEventService.PsdzEventListenerClient psdzEventListenerClient = new PsdzEventService.PsdzEventListenerClient(psdzEventListener, this.binding, this.endpointAddress);
                    psdzEventListenerClient.StartListening();
                    this.eventListenerClients.Add(psdzEventListener, psdzEventListenerClient);
                }
            }
        }
Пример #2
0
        public void RemoveEventListener(IPsdzEventListener psdzEventListener)
        {
            if (psdzEventListener == null)
            {
                return;
            }
            IDictionary <IPsdzEventListener, PsdzEventService.PsdzEventListenerClient> obj = this.eventListenerClients;

            lock (obj)
            {
                if (this.eventListenerClients.ContainsKey(psdzEventListener))
                {
                    PsdzEventService.PsdzEventListenerClient psdzEventListenerClient = this.eventListenerClients[psdzEventListener];
                    psdzEventListenerClient.StopListening();
                    psdzEventListenerClient.Close();
                    this.eventListenerClients.Remove(psdzEventListener);
                }
            }
        }