Example #1
0
        /// <summary>
        /// 添加监听器
        /// </summary>
        /// <param name="msgType">数据类别键</param>
        /// <param name="delHandle">消息委托</param>
        public static void AddListner(string msgType, ContextModel.MessageDelegate delHandle)
        {
            if (_modelDic.ContainsKey(msgType))
            {
                _modelDic[msgType].AddListner(delHandle);
                return;
            }
            ContextModel model = new ContextModel();

            model.AddListner(delHandle);
            _modelDic.AddKeyValue(msgType, model);
        }
Example #2
0
 /// <summary>
 /// 添加消息监听
 /// </summary>
 /// <param name="msgType">消息名</param>
 /// <param name="msgDelegate">消息委托</param>
 protected void ReceiveMessage(string msgType, ContextModel.MessageDelegate msgDelegate)
 {
     MessageDispatcher.AddListner(msgType, msgDelegate);
 }