private void BotClient_OnResponse(string message, MessageType type) { switch (type) { case MessageType.History: this.Dispatcher.BeginInvoke((Action)(() => { if (message.Contains(requestName)) { StartButton_Click(this, new RoutedEventArgs()); } HistoryText.AppendText(message + "\n"); SendText.Focus(); HistoryText.ScrollToEnd(); })); break; case MessageType.Metadata: this.Dispatcher.BeginInvoke((Action)(() => { MetaText.AppendText(message + "\n"); SendText.Focus(); MetaText.ScrollToEnd(); })); break; default: break; } }
void postHistory(string message) { //Posts a message to the history box, automatically adds the timestamp and tabs, new line HistoryText.AppendText($"\n{getTimestamp()}:\t " + message); }