예제 #1
0
        public static void Subscribe(Type type, string eventName, EventHandler listener)
        {
            string eventKey = GetEventKey(type, eventName);

            _listeners.AddMissing(eventKey, new HashSet <EventSubscription>());
            _listeners[eventKey].Add(EventSubscription.FromEventHandler(listener));
        }
예제 #2
0
        public virtual void Subscribe(string eventName, EventHandler handler)
        {
            if (!_listeners.ContainsKey(eventName))
            {
                _listeners.Add(eventName, new HashSet <EventSubscription>());
            }

            _listeners[eventName].Add(EventSubscription.FromEventHandler(handler));
        }