Пример #1
0
        public void Run <A>(EventIdType type, A a)
        {
            List <object> iEvents = null;

            if (!this.allEvents.TryGetValue(type, out iEvents))
            {
                return;
            }

            foreach (object obj in iEvents)
            {
                try
                {
                    var iEvent = obj as IEvent <A>;
                    if (iEvent == null)
                    {
                        throw new Exception($"event type: {type} is not IEvent<{typeof (A).Name}>");
                    }
                    iEvent.Run(a);
                }
                catch (Exception err)
                {
                    Log.Error(err.ToString());
                }
            }
        }
Пример #2
0
        public void Run <A, B, C, D, E, F>(EventIdType type, A a, B b, C c, D d, E e, F f)
        {
            List <object> iEvents = null;

            if (!this.allEvents.TryGetValue(type, out iEvents))
            {
                return;
            }

            foreach (object obj in iEvents)
            {
                try
                {
                    var iEvent = obj as IEvent <A, B, C, D, E, F>;
                    if (iEvent == null)
                    {
                        throw new Exception(
                                  $"event type: {type} is not IEvent<{typeof(A).Name}, {typeof(B).Name}, {typeof(C).Name}, {typeof(D).Name}, {typeof(E).Name}>");
                    }
                    iEvent.Run(a, b, c, d, e, f);
                }
                catch (Exception err)
                {
                    Log.Error(err.ToString());
                }
            }
        }
Пример #3
0
        public void Run <A, B, C>(EventIdType type, A a, B b, C c)
        {
            List <IEventMethod> iEvents;

            if (!this.allEvents.TryGetValue(type, out iEvents))
            {
                return;
            }
            foreach (IEventMethod iEvent in iEvents)
            {
                try
                {
                    iEvent.Run(a, b, c);
                }
                catch (Exception e)
                {
                    Log.Error(e.ToString());
                }
            }
        }
Пример #4
0
        public void Run(EventIdType type)
        {
            List <object> iEvents;

            if (!this.allEvents.TryGetValue(type, out iEvents))
            {
                return;
            }
            foreach (object obj in iEvents)
            {
                try
                {
                    IEvent iEvent = (IEvent)obj;
                    iEvent.Run();
                }
                catch (Exception e)
                {
                    Log.Error(e.ToString());
                }
            }
        }
Пример #5
0
        public void Run <A, B, C>(EventIdType type, A a, B b, C c)
        {
            List <object> iEvents;

            if (!this.allEvents.TryGetValue(type, out iEvents))
            {
                return;
            }

            foreach (object obj in iEvents)
            {
                try
                {
                    IEvent <A, B, C> iEvent = (IEvent <A, B, C>)obj;
                    iEvent.Run(a, b, c);
                }
                catch (Exception err)
                {
                    Log.Error(err.ToString());
                }
            }
        }
Пример #6
0
 protected AEventAttribute(EventIdType type)
 {
     this.Type = type;
 }