public void AddData(long[] timestamps, byte[] addr, byte[][] data) { for (int i = 0; i < timestamps.Length; i++) { DateTime timestamp = new DateTime(timestamps[i]); String s = "[" + timestamp.Hour.ToString() + ":" + timestamp.Minute.ToString() + ":" + timestamp.Second.ToString() + "." + timestamp.Millisecond.ToString("d3") + "]"; s += ": 0x"; s += addr[i].ToString("X2"); s += ": "; for (int j = 0; j < data[i].Length; j++) { s += " " + data[i][j].ToString("X2"); } s += Environment.NewLine; IOBox.BeginInvoke(new MethodInvoker( delegate { IOBox.AppendText(s); })); } ScrollToEnd(IOBox); /*IOBox.BeginInvoke(new MethodInvoker( * delegate * { * IOBox.SelectionStart = IOBox.Text.Length - 1; * IOBox.ScrollToCaret(); * }));*/ }
/// <summary> /// Add text to the pane /// Note: Threadsafe /// </summary> /// <param name="s">String to add</param> public void AddRawText(string s) { IOBox.BeginInvoke(new MethodInvoker( delegate { IOBox.AppendText(s); })); }
public void AddChar(char c) { BeginInvoke(new MethodInvoker(() => { IOBox.AppendText(c.ToString(CultureInfo.InvariantCulture)); //IOBox.LineWrapping.WrapLines(0, int.MaxValue, IOBox.Width); })); }
public void AddLine(string line) { BeginInvoke(new MethodInvoker( () => { IOBox.AppendText(line); //IOBox.LineWrapping.WrapLines(0, int.MaxValue, IOBox.Width); IOBox.Scrolling.ScrollBy(0, IOBox.Lines.Count); })); }
/// <summary> /// Add multiple lines to the pane /// Note: Threadsafe /// </summary> /// <param name="timestamps">Timestamp for each line</param> /// <param name="addr">Address for each line</param> /// <param name="data">Data array for each line</param> public void AddData(long[] timestamps, byte[] addr, byte[][] data) { for (int i = 0; i < timestamps.Length; i++) { timestamp = new DateTime(timestamps[i]); String s = "[" + timestamp.Hour.ToString() + ":" + timestamp.Minute.ToString() + ":" + timestamp.Second.ToString() + "." + timestamp.Millisecond.ToString("d3") + "]"; s += ": "; s += addr[i].ToString(); s += ": "; s += System.Text.UnicodeEncoding.ASCII.GetString(data[i], 0, data[i].Length); s += Environment.NewLine; IOBox.BeginInvoke(new MethodInvoker( delegate { IOBox.AppendText(s); })); } ScrollToEnd(IOBox); }