예제 #1
0
 /// <summary>
 /// 绑定注册(立即)
 /// </summary>
 /// <param name="handle"></param>
 /// <param name="id"></param>
 public static void BindEventHandler(DispatcherEventHandler handle, EProtocolId id)
 {
     try
     {
         DictProtocolEvent[id] = handle;
         loger.Info($"注册消息 {id,-30} -> {(int)id,-10} 成功!");
     }
     catch
     {
         loger.Warn($"注册消息 {id,-30} -> {(int)id,-10} 失败!");
     }
 }
예제 #2
0
 //绑定注册
 public static void BindEventHandler(DispatcherEventHandler handle, EProtocolId id)
 {
     try
     {
         ProtocolEvent Event = new ProtocolEvent();
         Event.EventHandler += new DispatcherEventHandler(handle);
         DictProtocolEvent.Add(id, Event);
         Debug(string.Format("注册消息->  {0,-30} -> {1,-10} 成功", id, (int)id));
     }
     catch
     {
         Error(string.Format("注册消息->  {0,-30} -> {1,-10} 失败", id, (int)id));
     }
 }