Esempio n. 1
0
 public void Register(string eventId, SubscriptionsCallback method)
 {
     //associate an event handler for an eventId
     List<Delegate> delegates = null;
     if (!_subscriptions.TryGetValue(eventId, out delegates))
     {
         delegates = new List<Delegate>();
         _subscriptions[eventId] = delegates;
     }
     delegates.Add(method);
 }
Esempio n. 2
0
 public void Unregister(string eventId, SubscriptionsCallback method)
 {
     //unassociate a specific event handler method for the eventId
     List<Delegate> delegates = null;
     if (_subscriptions.TryGetValue(eventId, out delegates))
     {
         delegates.Remove(method);
         if (delegates.Count == 0)
         {
             _subscriptions.Remove(eventId);
         }
     }
 }