public void ProcessVoice() { while (isSpeechRendering) { if (speechManager.CheckIfMessageIsInQueue()) { string stringToDispatch = speechManager.GetMessageFromQueue(); string text = ""; System.Windows.Application.Current.Dispatcher.Invoke((ThreadStart) delegate { text = ChatLog.Text; }); if (text.Length < 700) { Dispatcher.BeginInvoke((Action)(() => ChatLog.Text = ChatLog.Text + "\r Detected:" + stringToDispatch)); } else { Dispatcher.BeginInvoke((Action)(() => ChatLog.Text = "\r Detected:" + stringToDispatch)); } inputManager.AddStringToIncomingInstructions(stringToDispatch); } } }