コード例 #1
0
 /// <summary>
 /// 发送聊天内容
 /// </summary>
 private void RaiseSendStringHandler()
 {
     if (string.IsNullOrEmpty(ChatString))
     {
         return;
     }
     App.Current.Dispatcher.Invoke(() =>
     {
         var info = new ChatInfoModel
         {
             Message  = ChatString,
             SenderId = _id,
             Type     = ChatMessageType.String,
             Role     = ChatRoleType.Sender
         };
         ChatInfos.Add(info);
     });
     ClientEventHandler.SendData(new NettyBody()
     {
         code   = (int)NettyCodeEnum.Chat,
         time   = UtilHelper.GetCurrentTimeStamp(),
         msg    = "客户端请求",
         fromId = "",
         reqId  = Guid.NewGuid().ToString(),
         data   = ChatString
     });
     ChatString = string.Empty;
 }