public void AddInfo(InfoType type, string msg) { App.Current.Dispatcher.Invoke(() => { var item = new InfoLine(type, msg); InfoList.Items.Add(item); InfoList.ScrollIntoView(item); }); }
private void Serial_DataReceived(object sender, SerialDataReceivedEventArgs e) { Application.Current.Dispatcher.Invoke(new Action(() => { char[] content = new char[serial.BytesToRead]; serial.Read(content, 0, serial.BytesToRead); InfoList.Items.Add(new string(content)); InfoList.ScrollIntoView(InfoList.Items[InfoList.Items.Count - 1]); })); }
private void Log(String message) { InfoList.Items.Add(message); InfoList.ScrollIntoView(InfoList.Items[InfoList.Items.Count - 1]); }