public void AddMessage(Message message) { Invoke((MethodInvoker)(() => { chatBox.AppendText("\n"); //AppendStyle("--", SelfMentionStyle); AppendStyle(message.Time.ToString("hh:mmtt"), TimeStyle); AppendStyle(" "); AppendStyle(message.SenderTrip, TripStyle); chatBox.AppendText(" "); AppendStyle(message.SenderName, UsernameStyle); chatBox.AppendText(": "); //if multiline message, make every line on its own line if (message.PlainText.Contains("\n")) { chatBox.AppendText("\n"); } foreach (var node in message.RichText) { switch (node.Type) { case RichTextNode.NodeType.Text: AppendStyle(node.Value, message.IsSelfMention ? SelfMentionStyle : null); break; case RichTextNode.NodeType.Formatted: AppendStyle(node.Value, LatexStyle); break; case RichTextNode.NodeType.Username: AppendStyle(node.Value, UsernameStyle); break; } } })); }
public override void OnMessage(Message message) => parentChatView.AddMessage(message);