Exemple #1
0
        private void m_btnSaveParaToIni_Click(object sender, EventArgs e)
        {
            string strMsg = string.Format("确定要保存{0}的通讯参数吗?", m_cBoxSelHardware.Text);

            if (MessageBox.Show(strMsg, @"提醒", MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return;
            }

            string          strEquipment = m_cBoxSelHardware.Text;
            STRUCT_CMT_INFO tCmtInfo     = new STRUCT_CMT_INFO {
                m_nType = m_cBoxCmtPattern.SelectedIndex
            };

            switch (m_cBoxCmtPattern.SelectedIndex)
            {
            case 0:
                tCmtInfo.m_strSerialPortNum  = m_cBoxPortNo.Text;
                tCmtInfo.m_nSerialBaudRate   = Convert.ToInt32(m_cBoxBaudRate.Text);
                tCmtInfo.m_nSerialDateBits   = Convert.ToInt32(m_cBoxDateBits.Text);
                tCmtInfo.m_strSerialStopBits = m_cBoxStopBits.Text;
                tCmtInfo.m_strSerialParity   = m_cBoxParity.Text;

                break;

            case 1:
                tCmtInfo.m_strStcpAddress = m_tBoxAddress.Text;
                tCmtInfo.m_nStcpPort      = Convert.ToInt32(m_tBoxPort.Text);
                break;
            }

            m_oKernel.SaveCmtParaToIni(strEquipment, tCmtInfo);
        }