コード例 #1
0
        public FormSetSerial(SerialCom com)
        {
            this.serial = com;

            InitializeComponent();
            this.serialInfo = dbhandler.GetSerialInfo();

            //用配置中的连接信息初始化界面展示
            this.cbPorts.Text             = this.serialInfo.PortName;
            this.tbDatabits.Text          = this.serialInfo.DataBits.ToString();
            this.cbParity.SelectedIndex   = this.serialInfo.Parity;;
            this.cbStopbits.SelectedIndex = this.serialInfo.StopBits;
            this.tbTimeout.Text           = this.serialInfo.TimeOut.ToString();
            for (int i = 0; i < this.cbBaudrate.Items.Count; i++)
            {
                if (this.serialInfo.BaudRate != Convert.ToInt32(this.cbBaudrate.Items[i]))
                {
                    continue;
                }
                this.cbBaudrate.SelectedIndex = i; break;
            }
            this.btnFresh_Click(null, null);
        }
コード例 #2
0
ファイル: FormSerial.cs プロジェクト: wwkkww1983/LeProj
        private void InitialSeiralInfo()
        {
            this.serialInfo = new DBUtility(true).GetSerialInfo();
            this.btnFresh_Click(null, null);

            //用配置中的连接信息初始化界面展示
            this.cbPorts.Text             = this.serialInfo.PortName;
            this.tbDatabits.Text          = this.serialInfo.DataBits.ToString();
            this.cbParity.SelectedIndex   = this.serialInfo.Parity;;
            this.cbStopbits.SelectedIndex = this.serialInfo.StopBits;
            this.tbTimeout.Text           = this.serialInfo.TimeOut.ToString();
            for (int i = 0; i < this.cbBaudrate.Items.Count; i++)
            {
                if (this.serialInfo.BaudRate != Convert.ToInt32(this.cbBaudrate.Items[i]))
                {
                    continue;
                }
                this.cbBaudrate.SelectedIndex = i; break;
            }

            this.serial = new SerialCom();
            this.DisableSendComponent(true);
        }