private void MonitorData(byte[] buf, int size) { byte[] data = buf.Take(size).ToArray(); string t = TransToString(data); Dispatcher.Invoke(() => { MonitorTextBox.AppendText(t); }); }
private void Monitor(string str) { try { this.Dispatcher.Invoke(() => { MonitorTextBox.AppendText(str + Environment.NewLine); MonitorTextBox.ScrollToLine(MonitorTextBox.LineCount - 1); }); } catch (Exception e) { Console.WriteLine(e); } }