/// <summary> /// 458串口配置显示 /// </summary> /// <param name="c232Config">458串口配置</param> private void setDataToControl(DH_485_CFG c458Config) { try { cmb458DecProName.SelectedIndex = (int)c458Config.wProtocol; cmb458DataBit.SelectedIndex = (int)((uint)c458Config.struComm.byDataBit); cmb458StopBit.SelectedIndex = (int)((uint)c458Config.struComm.byStopBit); cmb458BaudRate.SelectedIndex = (int)((uint)c458Config.struComm.byBaudRate); cmb458Parity.SelectedIndex = (int)((uint)c458Config.struComm.byParity); txt458Add.Text = c458Config.wDecoderAddress.ToString(); } catch { MessageBox.Show("赋值错误!", pMsgTitle); } }
/// <summary> /// 485串口信息保存 /// </summary> /// <param name="rs232Config"></param> private void COMSaveData(ref DH_485_CFG rs485Config) { try { rs485Config.wDecoderAddress = (ushort)int.Parse(txt458Add.Text); rs485Config.struComm.byBaudRate = (byte)cmb458BaudRate.SelectedIndex; rs485Config.struComm.byDataBit = (byte)cmb458DataBit.SelectedIndex; rs485Config.struComm.byParity = (byte)cmb458Parity.SelectedIndex; rs485Config.struComm.byStopBit = (byte)cmb458StopBit.SelectedIndex; rs485Config.wProtocol = (ushort)cmb458DecProName.SelectedIndex; } catch { MessageBox.Show("保存错误!", pMsgTitle); } }