Example #1
0
        /// <summary>
        /// 设置通信端口的参数
        /// </summary>
        private void SetCOMMSerialPortParam()
        {
            if ((this.m_COMMComboBox.Text != null) && (this.m_COMMComboBox.Items.Count > 0))
            {
                COMMSerialPortParamForm p = new COMMSerialPortParamForm(this.m_COMMComboBox.Text, this.m_COMMSerialPortParam);

                if (p.ShowDialog(this.m_COMMComboBox) != System.Windows.Forms.DialogResult.OK)
                {
                    if (this.m_COMMRichTextBox != null)
                    {
                        RichTextBoxPlus.AppendTextInfoTopWithDataTime(this.m_COMMRichTextBox, "通信端口参数配置失败。\r\n", Color.Red, false);
                    }
                }
                else
                {
                    this.m_COMMSerialPortParam = ((COMMSerialPortParamForm)p).m_COMMSerialPortParam;

                    if (this.m_COMMRichTextBox != null)
                    {
                        RichTextBoxPlus.AppendTextInfoTopWithDataTime(this.m_COMMRichTextBox, "通信端口参数配置成功。\r\n", Color.Black, false);
                    }

                    p.CloseForm();
                }
            }
        }
Example #2
0
        /// <summary>
        /// 设置参数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void COMMSerialPortParam_Click(object sender, EventArgs e)
        {
            if ((this.m_COMMComboBox.Text != null) && (this.m_COMMComboBox.Items.Count > 0))
            {
                COMMSerialPortParamForm p = new COMMSerialPortParamForm(this.m_COMMComboBox.Text);

                if (p.ShowDialog(this.m_COMMComboBox) != System.Windows.Forms.DialogResult.OK)
                {
                    if (this.m_COMMRichTextBox != null)
                    {
                        RichTextBoxPlus.AppendTextInfoTopWithDataTime(this.m_COMMRichTextBox, "通信端口参数配置失败。\r\n", Color.Red, false);
                    }
                    return;
                }

                this.m_COMMSerialPortParam = ((COMMSerialPortParamForm)p).m_COMMSerialPortParam;

                if (this.m_COMMRichTextBox != null)
                {
                    RichTextBoxPlus.AppendTextInfoTopWithDataTime(this.m_COMMRichTextBox, "通信端口参数配置成功。\r\n", Color.Black, false);
                }

                p.CloseForm();
            }
        }