Beispiel #1
0
 /// <summary>
 /// 232串口配置显示
 /// </summary>
 /// <param name="c232Config">232串口配置</param>
 private void setDataToControl(DH_RS232_CFG c232Config)
 {
     try
     {
         cmbCOMFunction.SelectedIndex = (int)((uint)c232Config.byFunction);
         cmbCOMDataBit.SelectedIndex = (int)((uint)c232Config.struComm.byDataBit);
         cmbCOMStopBit.SelectedIndex = (int)((uint)c232Config.struComm.byStopBit);
         cmbCOMBaudRate.SelectedIndex = (int)((uint)c232Config.struComm.byBaudRate);
         cmbCOMParity.SelectedIndex = (int)((uint)c232Config.struComm.byParity);
     }
     catch
     {
         MessageBox.Show("赋值错误!", pMsgTitle);
     }
 }
Beispiel #2
0
 /// <summary>
 /// 232串口信息保存
 /// </summary>
 /// <param name="rs232Config"></param>
 private void COMSaveData(ref DH_RS232_CFG rs232Config)
 {
     try
     {
         rs232Config.struComm.byBaudRate = (byte)cmbCOMBaudRate.SelectedIndex;
         rs232Config.struComm.byDataBit = (byte)cmbCOMDataBit.SelectedIndex;
         rs232Config.struComm.byParity = (byte)cmbCOMParity.SelectedIndex;
         rs232Config.struComm.byStopBit = (byte)cmbCOMStopBit.SelectedIndex;
         rs232Config.byFunction = (byte)cmbCOMFunction.SelectedIndex;
     }
     catch
     {
         MessageBox.Show("保存错误!", pMsgTitle);
     }
 }