/// <summary> /// Clear the chat history /// </summary> public override void ClearChatHistory() { ChatHistory.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { ChatHistory.Text = ""; ChatHistoryScroller.ScrollToVerticalOffset(ChatHistoryScroller.ScrollableHeight); ChatHistoryScroller.UpdateLayout(); }).AsTask(); }
/// <summary> /// Clear the chat history /// </summary> public override void ClearChatHistory() { ChatHistory.Dispatcher.BeginInvoke(new Action(() => { ChatHistory.Text = ""; ChatHistoryScroller.ScrollToVerticalOffset(ChatHistoryScroller.ScrollableHeight); ChatHistoryScroller.UpdateLayout(); })); }
/// <summary> /// Add text to the chat history /// </summary> /// <param name="message"></param> public override void AppendLineToChatHistory(string message) { //To ensure we can succesfully append to the text box from any thread //we need to wrap the append within an invoke action. ChatHistory.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { ChatHistory.Text += message + "\n"; ChatHistoryScroller.ScrollToVerticalOffset(ChatHistoryScroller.ScrollableHeight); ChatHistoryScroller.UpdateLayout(); }).AsTask(); }
/// <summary> /// Add text to the chat history /// </summary> /// <param name="message"></param> public override void AppendLineToChatHistory(string message) { //To ensure we can successfully append to the text box from any thread //we need to wrap the append within an invoke action. ChatHistory.Dispatcher.BeginInvoke(new Action <string>((messageToAdd) => { ChatHistory.Text += messageToAdd + "\n"; ChatHistoryScroller.ScrollToVerticalOffset(ChatHistoryScroller.ScrollableHeight); ChatHistoryScroller.UpdateLayout(); }), new object[] { message }); }