Ejemplo n.º 1
0
        public EventListenerCustom AddCustomEventListener(string eventName, EventListenerCustom.OnEventCustomHandler callback, object addition)
        {
            EventListenerCustom listener = null;

            if (_custom.ContainsKey(eventName))
            {
                listener = _custom[eventName];
                if (listener == null)
                {
                    listener           = new EventListenerCustom(eventName, callback, addition);
                    _custom[eventName] = listener;
                }
                else
                {
                    // remove
                    _custom.Remove(eventName);
                    listener           = new EventListenerCustom(eventName, callback, addition);
                    _custom[eventName] = listener;
                }
            }
            else
            {
                listener           = new EventListenerCustom(eventName, callback, addition);
                _custom[eventName] = listener;
            }

            return(listener);
        }
Ejemplo n.º 2
0
        public EventListenerCustom SubCustomEventListener(string eventName, EventListenerCustom.OnEventCustomHandler callback, object addition)
        {
            List <EventListenerCustom> li = null;

            if (_custom.ContainsKey(eventName))
            {
                li = _customSub[eventName];
                var listener = new EventListenerCustom(eventName, callback, addition);
                li.Add(listener);
                return(listener);
            }
            else
            {
                li = new List <EventListenerCustom>();
                var listener = new EventListenerCustom(eventName, callback, addition);
                li.Add(listener);
                _customSub[eventName] = li;
                return(listener);
            }
        }