private void GetDataAndUpdateConsolOutputBox() { while (running) { SocketServerEx.GetReceivedDataEvent().WaitOne(); string str = SocketServerEx.GetData(); Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { tbConsoleOutPut.Text = DateTime.Now.ToString("h:mm:ss tt") + " Client: " + str + tbConsoleOutPut.Text; })); } }
private void GetDataAndUpdateConsoleOutputBox() { while (running) { SocketServerEx.GetReceivedDataEvent().WaitOne(); //SocketServerEx.GetAutoResetEvent().WaitOne(); var str = SocketServerEx.GetData(); var size = str.Length; Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart( delegate { tbConsoleOutput.Text = tbConsoleOutput.Text + DateTime.Now.ToString("h:mm:ss tt") + " Client:\n" + str; tbConsoleOutput.ScrollToEnd(); })); } }