Exemple #1
0
        /// <summary>
        /// 发送到监听者
        /// </summary>
        /// <param name="operateType">操作类型</param>
        /// <param name="requstID">请求ID</param>
        /// <param name="result">返回的结果</param>
        public void SendToListener(int operateType, int requstID, String result)
        {
            THSDealListener listener = null;

            lock (m_listeners)
            {
                if (m_listeners.ContainsKey(operateType))
                {
                    listener = m_listeners[operateType];
                }
            }
            if (listener != null)
            {
                listener.CallBack(operateType, requstID, result);
            }
        }
Exemple #2
0
 /// <summary>
 /// 注册数据监听
 /// </summary>
 /// <param name="operateType">请求ID</param>
 /// <param name="callBack">回调函数</param>
 public void RegisterListener(int operateType, THSDealCallBack callBack)
 {
     lock (m_listeners)
     {
         THSDealListener listener = null;
         if (!m_listeners.ContainsKey(operateType))
         {
             listener = new THSDealListener();
             m_listeners[operateType] = listener;
             m_pushRegisterIDs.Add(operateType);
         }
         else
         {
             listener = m_listeners[operateType];
         }
         listener.Add(callBack);
     }
 }