Exemple #1
0
 public void AddMessage(Message msg)
 {
     if (Messages.Count > 0 && Messages.Count >= MaxChatCacheCount)
     {
         Messages.RemoveAt(0);
     }
     Messages.Add(msg);
     OnAddMessage?.Invoke(msg);
 }
    public void AddMessageToChatWindow(string jsonMessage)
    {
        ChatMessage message = JsonUtility.FromJson <ChatMessage>(jsonMessage);

        if (message == null)
        {
            return;
        }

        entries.Add(message);
        OnAddMessage?.Invoke(message);
    }
Exemple #3
0
 public void AddMessage(MessageInfo msg)
 {
     if (this.receivedMsgControl1.InvokeRequired)
     {
         var a = new OnAddMessage(AddMessage);
         this.Invoke(a, new object[] { msg });
     }
     else
     {
         this.receivedMsgControl1.AddMessage(msg);
     }
 }
 private void ProcessSyncResult(SyncResponse result)
 {
     // 处理消息
     if (result.AddMsgCount > 0)
     {
         foreach (var msg in result.AddMsgList)
         {
             var message = MessageFactory.CreateMessage(msg);
             OnAddMessage?.Invoke(this, new AddMessageEvent()
             {
                 Msg = message
             });
         }
     }
 }
Exemple #5
0
 public MildomJoinRoom(OnAddMessage add) : base(add.Raw)
 {
     UserId       = add.UserId.ToString();
     Id           = "";
     CommentItems = new List <IMessagePart> {
         Common.MessagePartFactory.CreateMessageText(add.Message)
     };
     NameItems = new List <IMessagePart> {
         Common.MessagePartFactory.CreateMessageText(add.UserName)
     };
     UserIcon = new Common.MessageImage
     {
         Url    = add.UserImg,
         X      = null,
         Y      = null,
         Height = null,
         Width  = null,
     };
     PostedAt = add.PostedAt;
 }
 public void RaiseAddMessage(ChatMessage chatMessage)
 {
     entries.Add(chatMessage);
     OnAddMessage?.Invoke(chatMessage);
 }