private void btnCommCommand_Click(object sender, EventArgs e) { if (_serialPort == null) { Log("Serial port is not connected.", Color.Red); return; } try { Comm_Command command = new Comm_Command(); 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 btnCommCommand_Click(object sender, EventArgs e) { if (_serialPort == null) { Log("Serial port is not connected.", Color.Red); return; } try { Comm_Command command = new Comm_Command(); 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); } }