Esempio n. 1
0
 public void removeListener(int eventType, EventSourceEx <T> .HandlerData listener)
 {
     lock (this.Mutex)
     {
         List <EventSourceEx <T> .HandlerData> listenerList = null;
         if (this.listeners.TryGetValue(eventType, out listenerList))
         {
             lock (listenerList)
             {
                 listenerList.RemoveAll((EventSourceEx <T> .HandlerData x) => x.Handler == listener.Handler);
             }
         }
     }
 }
Esempio n. 2
0
 public void registerListener(int eventType, EventSourceEx <T> .HandlerData listener)
 {
     lock (this.Mutex)
     {
         List <EventSourceEx <T> .HandlerData> listenerList;
         if (!this.listeners.TryGetValue(eventType, out listenerList))
         {
             listenerList = new List <EventSourceEx <T> .HandlerData>();
             this.listeners.Add(eventType, listenerList);
         }
         lock (listenerList)
         {
             listenerList.Add(listener);
         }
     }
 }