public void InitializeForm() { string[] baudrate = { "2400", "4800", "9600", "19200", "38400", "57600", "115200" }; try { cbSetup_SerialPort.Items.Add("None"); foreach (string s in Serial_Port.GetPortNames()) { cbSetup_SerialPort.Items.Add(s); } cbSetup_SerialPort.SelectedIndex = 0; foreach (string s in baudrate) { cbSetup_SerialBaud.Items.Add(s); } cbSetup_SerialBaud.SelectedIndex = 6; rbSetup_Server.Checked = true; Display(0); } catch (Exception ex) { AddLog(Log.Type.LOG_ERR, "InitializeForm Error : {0}", ex.Message); } }
/// <summary> /// Serial 생성 및 동작 /// </summary> private bool InitializeSerial() { bool result = false; try { if (ConnInfo == null) { return(false); } if (Serial == null) { Serial = new Serial_Port(); } result = Serial.OpenPort(ConnInfo.Serial.Port, ConnInfo.Serial.Baud, ConnInfo.Serial.DtrRts); Serial.SerialReceived += new EventHandler <Serial_Port.SerialDataEventArgs>(SerialReceived); } catch (Exception err) { AddLog(Log.Type.LOG_ERR, "InitializeSerial Error:{0}", err.Message); } return(result); }