private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (JohnbeeSerialPort.MySerialPort.IsOpen) { JohnbeeSerialPort.SerialPort_Close(); } }
private void Comb_Bps_SelectedIndexChanged(object sender, EventArgs e) { if (JohnbeeSerialPort.SerialPort_Close() == 0) { btn_open.Text = "Open"; JohnbeeSerialPort.Set_PortBps(Comb_Bps.Text); } }
private void btn_open_Click(object sender, EventArgs e) { if (btn_open.Text == "Open") { if (JohnbeeSerialPort.SerialPort_Open() == 0) { btn_open.Text = "Colse"; Comb_Bps.Enabled = false; Comb_Port.Enabled = false; btn_Refresh.Enabled = false; } } else if (btn_open.Text == "Colse") { if (JohnbeeSerialPort.SerialPort_Close() == 0) { btn_open.Text = "Open"; Comb_Bps.Enabled = true; Comb_Port.Enabled = true; btn_Refresh.Enabled = true; } } }