Ejemplo n.º 1
0
        private void toolStripButtonApply_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("将替换现有校准参数,是否继续?", "确认", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);

            if (dialogResult != DialogResult.Yes)
            {
                return;
            }

            if (m_calParamAviable)
            {
                if (m_calParamValList.Count > 0)
                {
                    m_flowSensor.SetCalibrationParamList(m_calParamValList, m_calParamValListP, m_calParamValListN, m_minPresure, m_maxPresure);
                    /* 保存校准参数 */
                    Properties.Settings.Default.caliValList  = string.Join(",", m_calParamValList.ToArray());
                    Properties.Settings.Default.caliValListP = string.Join(",", m_calParamValListP.ToArray());
                    Properties.Settings.Default.caliValListN = string.Join(",", m_calParamValListN.ToArray());
                    Properties.Settings.Default.minPresure   = m_minPresure.ToString();
                    Properties.Settings.Default.maxPresure   = m_maxPresure.ToString();
                    Properties.Settings.Default.Save();
                    MessageBox.Show("应用校准参数【成功】!");
                }
                else
                {
                    MessageBox.Show("应用校准参数【失败】!");
                }
            }
            else
            {
                MessageBox.Show("应用校准参数【失败】!");
            }
        }
Ejemplo n.º 2
0
        /* 加载校准参数 */
        private void LoadCaliParam()
        {
            Console.WriteLine(Properties.Settings.Default.caliValList);

            if ((Properties.Settings.Default.caliValList != string.Empty) &&
                (Properties.Settings.Default.caliValListP != string.Empty) &&
                (Properties.Settings.Default.caliValListN != string.Empty) &&
                (Properties.Settings.Default.minPresure != string.Empty) &&
                (Properties.Settings.Default.maxPresure != string.Empty))
            {
                string[] strCaliVals      = Properties.Settings.Default.caliValList.Split(new char[] { ',' });
                var      calParamValList  = strCaliVals.Select(x => Convert.ToDouble(x)).ToList();
                string[] strCaliValsP     = Properties.Settings.Default.caliValListP.Split(new char[] { ',' });
                var      calParamValListP = strCaliValsP.Select(x => Convert.ToDouble(x)).ToList();
                string[] strCaliValsN     = Properties.Settings.Default.caliValListN.Split(new char[] { ',' });
                var      calParamValListN = strCaliValsN.Select(x => Convert.ToDouble(x)).ToList();
                double   minPresure       = Convert.ToDouble(Properties.Settings.Default.minPresure);
                double   maxPresure       = Convert.ToDouble(Properties.Settings.Default.maxPresure);

                m_flowSensor.SetCalibrationParamList(calParamValList, calParamValListP, calParamValListN, minPresure, maxPresure);
            }
        }