private void btnReadR1R2R3_Click(object sender, EventArgs e) { if (_serialPort == null) { Log("Serial port is not connected.", Color.Red); return; } try { Read_R1R2R3 command = new Read_R1R2R3(); if (!InitCommand(command)) { return; } command.Send(_serialPort); if (!command.Receive(_serialPort)) { return; } Log(command.ToString(), Color.Black); } catch (Exception ex) { Log(ex.Message, Color.Red); Log(ex.StackTrace, Color.Red); } }
private void btnReadR1R2R3_Click(object sender, EventArgs e) { if (_serialPort == null) { Log("Serial port is not connected.", Color.Red); return; } try { Read_R1R2R3 command = new Read_R1R2R3(); if (!InitCommand(command)) return; command.Send(_serialPort); if (!command.Receive(_serialPort)) return; Log(command.ToString(), Color.Black); } catch (Exception ex) { Log(ex.Message, Color.Red); Log(ex.StackTrace, Color.Red); } }