private void on_chat_message(object sender, NetChatEventArgs eventArgs) { string textToAppend = peer.Name + ": " + eventArgs.Message; Paragraph newParagraph = new Paragraph(new Run(textToAppend)) { LineHeight = 1, Foreground = Brushes.Orange }; ChatRichTextBoxFlowDocument.Blocks.Add(newParagraph); ChatRichTextBox.ScrollToEnd(); }
private void handleChatInput() { if (!String.IsNullOrEmpty(ChatTextInput.Text)) { //todo: put this back in when networking works again, else will crash cause I'm passing in a null peer peer.SendChat(ChatTextInput.Text); string textToAppend = humanPlayerName + ": " + ChatTextInput.Text; Paragraph newParagraph = new Paragraph(new Run(textToAppend)) { LineHeight = 1, Foreground = Brushes.Cyan }; ChatRichTextBoxFlowDocument.Blocks.Add(newParagraph); ChatRichTextBox.ScrollToEnd(); ChatTextInput.Clear(); } }