private void SDMC1SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e) { try { String reply = SDMC1SerialPort.ReadExisting(); SDMC1ReadText.Invoke(new MethodInvoker(delegate { SDMC1ReadText.Text = SDMC1ReadText.Text + reply; })); } catch (Exception error) { MessageText.Invoke(new MethodInvoker(delegate { MessageText.Text = error.Message; })); } }
private void ScanSDMC1_DataReceived(object sender, SerialDataReceivedEventArgs e) { try { SDMC1Message += SDMC1SerialPort.ReadExisting(); SDMC1ReadText.Invoke(new MethodInvoker(delegate { SDMC1ReadText.Text += SDMC1Message; })); if (SDMC1Message.Contains("\r")) { ArduinoSerialPort.WriteLine("read"); SDMC1Message = ""; } } catch (Exception error) { MessageText.Invoke(new MethodInvoker(delegate { MessageText.Text = error.Message; })); SDMC1Message = ""; } }