public static void SignalEvent <TEvents>(Action <TEvents> action) where TEvents : class
        {
            IEventManager manager;

            if (!EventManagers.TryGetValue(typeof(TEvents), out manager))
            {
                EventManagers.Add(typeof(TEvents), manager = new EventManager <TEvents>());
            }
            var m = manager as EventManager <TEvents>;

            m.Signal(action);
        }
Beispiel #2
0
        public static System.Action ListenFor(Type eventInterface, object listenerObject)
        {
            var listener = listenerObject;

            IEventManager manager;

            if (!EventManagers.TryGetValue(eventInterface, out manager))
            {
                EventManagers.Add(eventInterface,
                                  manager = (IEventManager)Activator.CreateInstance(
                                      typeof(EventManager <>).MakeGenericType(eventInterface)));
            }

            var m = manager;


            return(m.AddListener(listener));
        }