Esempio n. 1
0
        public void TriggerEvent(string eventType, object arg1, object arg2)
        {
            Delegate d;

            if (!m_theRouter.TryGetValue(eventType, out d))
            {
                return;
            }
            var callBacks = d.GetInvocationList();

            for (int i = 0; i < callBacks.Length; i++)
            {
                EventCallBack <object, object> callBack = callBacks[i] as EventCallBack <object, object>;
                if (null == callBack.Target)
                {
                    continue;
                }
                if (callBack == null)
                {
                    throw new Exception(string.Format("TriggerEvent {0} error:types of parameters not match", eventType));
                }
                try
                {
                    callBack(arg1, arg2);
                }
                catch (Exception ex)
                {
                    ZLogger.Except(ex);
                }
            }
        }