private void ua(string data) { Terminal.Invoke(new Action(delegate() { AT.ParseReceivedData(data, speedValueLabel, rangeValueLabel, stopFlagStateLabel); Terminal.Items.Add("Rx: " + data); })); }
private void serial_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { try { string data = serial.ReadLine(); if (data.Length == 0 || data == null) { return; } if (Terminal.InvokeRequired) { Terminal.Invoke(new Action(delegate() { AT.ParseReceivedData(data, speedValueLabel, rangeValueLabel, stopFlagStateLabel); Terminal.Items.Add("Rx: " + data); })); } else { Terminal.Items.Add(data); } } catch (IOException) { MessageBox.Show("Error reading from device!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Form1_Load(object sender, EventArgs e) { Uart.PrintPortNames(COMcombo); Uart.FillBaudrateBox(baudCombo); AT.PrintSpeed(speedCombo); AT.PrintDuration(angleCombo); // uart.Init(); }