private void BufferMsg(Dictionary<string, dynamic> dict, bool isMe = false) { Connection con = Connections[(int)dict["cid"]]; ChatBuffer buf = con.Buffers[(int)dict["bid"]]; var m = new Message { BufferId = (int)dict["bid"], ChannelName = dict["chan"], Eid = (long)dict["eid"], Text = dict["msg"], From = dict["from"] }; buf.AddMessage(m, isMe); }
internal void AddMessage(Message m, bool isMe = false) { _messages.Add(m); _dispatcher.Invoke(() => Messages.Add(m)); if (messageAdded != null && !isMe) messageAdded(this, new MessageEventArgs {Message = m}); else if (messageMeAdded != null && isMe) messageMeAdded(this, new MessageEventArgs {Message = m}); // Console.WriteLine("Message added to " + name); }