コード例 #1
0
        public XElement saveTestParamsToFile(F28LightCtrl.F28_PARAMETERS testParam, string profileName)
        {
            XElement   settingNode = new XElement("Settings");
            XAttribute name        = new XAttribute("name", profileName);

            settingNode.Add(name);
            foreach (string probName in paramNames)
            {
                XElement   paramNode = new XElement("Parameter");
                var        field     = testParam.GetType().GetField(probName);
                object     val       = field.GetValue(testParam);
                XAttribute at_name   = new XAttribute("property_name", probName);
                paramNode.Add(at_name);
                XAttribute at_val = new XAttribute("value", val);
                paramNode.Add(at_val);
                XAttribute at_type;

                if (field.FieldType.FullName == "System.UInt16")
                {
                    at_type = new XAttribute("type", "ushort");
                }
                else
                {
                    at_type = new XAttribute("type", "float");
                }
                paramNode.Add(at_type);
                settingNode.Add(paramNode);
            }

            return(settingNode);
        }
コード例 #2
0
ファイル: F28ViewFeeder.cs プロジェクト: kj831ca/F28Module
 private void ButtonSaveParam_Click(object sender, EventArgs e)
 {
     F28LightCtrl.F28_PARAMETERS testParam = new F28LightCtrl.F28_PARAMETERS();
     if (_api.readParameter(_selectModule.ModuleID, ref testParam))
     {
         _api.SaveParam("mynewParam", testParam);
     }
 }
コード例 #3
0
        public void formLoad(F28LightCtrl.F28_PARAMETERS m_tPara)
        {
            cboTestType.SelectedIndex = m_tPara.usTypeTest;

            edtFillTime.Text      = m_tPara.usTpsFill.ToString();
            edtStabTime.Text      = m_tPara.usTpsStab.ToString();
            edtTestTime.Text      = m_tPara.usTpsTest.ToString();
            edtFillVolTime.Text   = m_tPara.usTpsFillVol.ToString();
            edtTransfertTime.Text = m_tPara.usTpsTransfert.ToString();
            edtDumpTime.Text      = m_tPara.usTpsDump.ToString();

            cboP1Unit.SelectedIndex = m_tPara.usPress1Unit;
            edtMaxP1.Text           = m_tPara.fPress1Max.ToString();
            edtMinP1.Text           = m_tPara.fPress1Min.ToString();
            edtRatioMax.Text        = m_tPara.fRatioMax.ToString();
            edtRatioMin.Text        = m_tPara.fRatioMin.ToString();

            edtSetPoint.Text          = m_tPara.fSetFillP1.ToString();
            cboFillType.SelectedIndex = m_tPara.usFillMode;

            // V2.006
            if (m_tPara.usLeakUnit > (ushort)F28LightCtrl.F28_LEAK_UNITS.LEAK_POINTS)   // hole in unit list
            {
                cboLeakUnit.SelectedIndex = m_tPara.usLeakUnit - 6;
            }
            else
            {
                cboLeakUnit.SelectedIndex = m_tPara.usLeakUnit;
            }
            // V2.006
            edtLeakMax.Text = m_tPara.fRejectMax.ToString();
            edtLeakMin.Text = m_tPara.fRejectMin.ToString();

            cboVolUnit.SelectedIndex    = m_tPara.usVolumeUnit;
            edtVolume.Text              = m_tPara.fVolume.ToString("F2");
            cboRejectClac.SelectedIndex = m_tPara.usRejectCalc;

            // 1.402 Options
            chkSign.CheckState         = IsBit(m_tPara.usOptions, (int)eOptions.BIT_SIGN) > 0 ? CheckState.Checked : CheckState.Unchecked;
            chkNoNegative.CheckState   = IsBit(m_tPara.usOptions, (int)eOptions.BIT_NO_NEGATIVE) > 0 ? CheckState.Checked : CheckState.Unchecked;
            chkPressureCorr.CheckState = IsBit(m_tPara.usOptions, (int)eOptions.BIT_PRESSURE_COMP) > 0 ? CheckState.Checked : CheckState.Unchecked;

            // 1.500 Electronic Regulator
            chkElecReg.CheckState = IsBit(m_tPara.usOptions, (int)eOptions.BIT_ELECTRONIC_REGULATOR) > 0 ? CheckState.Checked : CheckState.Unchecked;



            edtAbsPress.Text = m_tPara.fPatmSTD.ToString("F2");
            edtTemp.Text     = m_tPara.fTempSTD.ToString("F2");
            edtFilter.Text   = m_tPara.fFilterTime.ToString();

            edtLeakOffset.Text = m_tPara.fOffsetLeak.ToString("F4");
        }
コード例 #4
0
        public void updateParam(ref F28LightCtrl.F28_PARAMETERS m_tPara)
        {
            m_tPara.usTypeTest = (ushort)cboTestType.SelectedIndex;

            m_tPara.usTpsFill      = ushort.Parse(edtFillTime.Text);
            m_tPara.usTpsStab      = ushort.Parse(edtStabTime.Text);
            m_tPara.usTpsTest      = ushort.Parse(edtTestTime.Text);
            m_tPara.usTpsFillVol   = ushort.Parse(edtFillVolTime.Text);
            m_tPara.usTpsTransfert = ushort.Parse(edtTransfertTime.Text);
            m_tPara.usTpsDump      = ushort.Parse(edtDumpTime.Text);

            m_tPara.usPress1Unit = (ushort)cboP1Unit.SelectedIndex;
            m_tPara.fPress1Max   = float.Parse(edtMaxP1.Text);
            m_tPara.fPress1Min   = float.Parse(edtMinP1.Text);
            m_tPara.fRatioMax    = float.Parse(edtRatioMax.Text);
            m_tPara.fRatioMin    = float.Parse(edtRatioMin.Text);

            m_tPara.fSetFillP1 = float.Parse(edtSetPoint.Text);
            m_tPara.usFillMode = (ushort)cboFillType.SelectedIndex;

            // V2.006
            if (cboLeakUnit.SelectedIndex > (int)F28LightCtrl.F28_LEAK_UNITS.LEAK_POINTS)   // hole in unit list
            {
                m_tPara.usLeakUnit = (ushort)(cboLeakUnit.SelectedIndex + 6);
            }
            else
            {
                m_tPara.usLeakUnit = (ushort)cboLeakUnit.SelectedIndex;
            }
            // V2.006
            m_tPara.fRejectMax = float.Parse(edtLeakMax.Text);
            m_tPara.fRejectMin = float.Parse(edtLeakMin.Text);

            m_tPara.usVolumeUnit = (ushort)cboVolUnit.SelectedIndex;
            m_tPara.fVolume      = float.Parse(edtVolume.Text);
            m_tPara.usRejectCalc = (ushort)cboRejectClac.SelectedIndex;


            // 1.402 Options
            SetBit(ref m_tPara.usOptions, (int)eOptions.BIT_SIGN, (chkSign.CheckState == CheckState.Checked));
            SetBit(ref m_tPara.usOptions, (int)eOptions.BIT_NO_NEGATIVE, chkNoNegative.CheckState == CheckState.Checked);
            SetBit(ref m_tPara.usOptions, (int)eOptions.BIT_PRESSURE_COMP, chkPressureCorr.CheckState == CheckState.Checked);

            // 1.500 Electronic Regulator
            SetBit(ref m_tPara.usOptions, (int)eOptions.BIT_ELECTRONIC_REGULATOR, chkElecReg.CheckState == CheckState.Checked);

            m_tPara.fPatmSTD    = float.Parse(edtAbsPress.Text);
            m_tPara.fTempSTD    = float.Parse(edtTemp.Text);
            m_tPara.fFilterTime = float.Parse(edtFilter.Text);

            m_tPara.fOffsetLeak = float.Parse(edtLeakOffset.Text);
        }
コード例 #5
0
        public void saveXML(string xmlFile, F28LightCtrl.F28_PARAMETERS testParam, string profileName)
        {
            xdoc = XDocument.Load(xmlFile);
            var f28Node     = xdoc.Descendants("F28Config").FirstOrDefault();
            var settingNode = xdoc.Descendants("Settings").Where(g => g.Attribute("name").Value == profileName);

            if (settingNode.FirstOrDefault() == null)
            {
                //XElement el = new XElement("Settings");
                //XAttribute at = new XAttribute("name", profileName);
                //el.Add(at);
                //XElement p1 = new XElement("Parameter");
                //XAttribute p = new XAttribute("property_name", "bah bah");
                //p1.Add(p);
                //el.Add(p1);
                //f28Node.Add(el);
                XElement el = saveTestParamsToFile(testParam, profileName);
                f28Node.Add(el);
                xdoc.Save(xmlFile);
            }
        }
コード例 #6
0
        public void loadParameterFromXML(string xmlFile)
        {
            xdoc = XDocument.Load(xmlFile);

            if (xdoc == null)
            {
                throw (new Exception("Unable to load XML file: " + xmlFile));
            }
            var nodes = xdoc.Descendants("Settings");

            foreach (XElement n in nodes)
            {
                string profileName = n.Attribute("name").Value;
                F28LightCtrl.F28_PARAMETERS tParams = new F28LightCtrl.F28_PARAMETERS();
                var    paramNode = n.Descendants("Parameter");
                object tP        = tParams;
                foreach (XElement el in paramNode)
                {
                    string probName = el.Attribute("property_name").Value;
                    string typeStr  = el.Attribute("type").Value;
                    string strVal   = el.Attribute("value").Value;
                    var    field    = tParams.GetType().GetField(probName);

                    if (typeStr == "ushort")
                    {
                        ushort uValue = ushort.Parse(strVal);
                        field.SetValue(tP, uValue);
                    }
                    else
                    {
                        float fValue = float.Parse(strVal);
                        field.SetValue(tP, fValue);
                    }
                }
                tParams = (F28LightCtrl.F28_PARAMETERS)tP;
                _controller.addParamToTable(profileName, tParams);
            }
        }
コード例 #7
0
        private void _api_OnParameterLoad(object sender, F28LightCtrl.F28_PARAMETERS e)
        {
            ParameterSet myParamSet = new ParameterSet((string)sender, e);

            _view.comboBoxProfileList.Items.Add(new ParameterSet((string)sender, e));
        }
コード例 #8
0
 public ParameterSet(string n, F28LightCtrl.F28_PARAMETERS tParam)
 {
     name       = n;
     parameters = tParam;
 }