Exemplo n.º 1
0
        private void btnKM三相表清EEPROM_Click(object sender, EventArgs e)
        {
            string strVol          = (float.Parse(tbVol.Text) * 100).ToString().PadLeft(8, '0');
            string strCurr         = (float.Parse(tbCurr.Text) * 1000).ToString().PadLeft(8, '0');
            string strMaxCurr      = (float.Parse(tbMaxCurr.Text) * 1000).ToString().PadLeft(8, '0');
            string strYouGongLevel = (float.Parse(tbYouGongLevel.Text) * 10).ToString().PadLeft(2, '0');
            string strWuGongLevel  = (float.Parse(tbWuGongLevel.Text) * 10).ToString().PadLeft(2, '0');
            string strYouGongConst = tbYouGongConst.Text.PadLeft(8, '0');
            string strWuGongConst  = tbWuGongConst.Text.PadLeft(8, '0');
            string strMeterModel   = comboBoxMeterModel.SelectedIndex.ToString().PadLeft(2, '0');
            string strProductDate  = tbProductDate.Text.PadLeft(8, '0');
            string strProtocalVer  = comboBoxProtocalVer.SelectedIndex.ToString().PadLeft(2, '0');

            Protocol645 p645 = new Protocol645();

            if (p645.KM3PhaseClrEEP(strVol, strCurr, strMaxCurr, strYouGongLevel, strWuGongLevel, strYouGongConst, strWuGongConst,
                                    strMeterModel, strProductDate, strProtocalVer))
            {
                MessageBox.Show("命令已发送!");
            }
            else
            {
                MessageBox.Show("命令发送失败!");
            }
        }