Пример #1
0
        public void CreatePumpXmlFile(string path)
        {
            if (File.Exists(path))
            {
                return;
            }

            XmlDocument xmlDoc = new XmlDocument();
            XmlNode     node   = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", "");

            xmlDoc.AppendChild(node);

            XmlNode root = xmlDoc.CreateElement("Method");

            xmlDoc.AppendChild(root);

            XmlNode config = xmlDoc.CreateNode(XmlNodeType.Element, "MethodConfig", null);

            AppConfig.CreateNode(xmlDoc, config, "LastMethodName", "默认");
            root.AppendChild(config);
            XmlNode user = xmlDoc.CreateNode(XmlNodeType.Element, "默认", null);

            root.AppendChild(user);
            XmlNode constant = xmlDoc.CreateNode(XmlNodeType.Element, "Constant", null);

            AppConfig.CreateNode(xmlDoc, constant, "ConstantFlow", (ConstantFlow_TextBox.Text = ""));
            AppConfig.CreateNode(xmlDoc, constant, "ConstantTime", (ConstantTime_TextBox.Text = ""));
            AppConfig.CreateNode(xmlDoc, constant, "ConstantPumpA", (ConstantPumpA_TextBox.Text = ""));
            AppConfig.CreateNode(xmlDoc, constant, "ConstantPumpB", (ConstantPumpB_TextBox.Text = ""));
            AppConfig.CreateNode(xmlDoc, constant, "ConstantPumpC", (ConstantPumpC_TextBox.Text = ""));
            AppConfig.CreateNode(xmlDoc, constant, "ConstantPumpD", (ConstantPumpD_TextBox.Text = ""));
            user.AppendChild(constant);
            XmlNode grad = xmlDoc.CreateNode(XmlNodeType.Element, "Gradient", null);

            AppConfig.CreateNode(xmlDoc, grad, "PumpACurvEn", (!(PumpA_Color.Checked = false)).ToString());
            AppConfig.CreateNode(xmlDoc, grad, "PumpBCurvEn", (!(PumpB_Color.Checked = false)).ToString());
            AppConfig.CreateNode(xmlDoc, grad, "PumpCCurvEn", (!(PumpC_Color.Checked = false)).ToString());
            AppConfig.CreateNode(xmlDoc, grad, "PumpDCurvEn", (!(PumpD_Color.Checked = false)).ToString());
            AppConfig.CreateNode(xmlDoc, grad, "PumpACurvColor", System.Drawing.ColorTranslator.ToHtml(PumpA_Color.BackColor));
            AppConfig.CreateNode(xmlDoc, grad, "PumpBCurvColor", System.Drawing.ColorTranslator.ToHtml(PumpB_Color.BackColor));
            AppConfig.CreateNode(xmlDoc, grad, "PumpCCurvColor", System.Drawing.ColorTranslator.ToHtml(PumpC_Color.BackColor));
            AppConfig.CreateNode(xmlDoc, grad, "PumpDCurvColor", System.Drawing.ColorTranslator.ToHtml(PumpD_Color.BackColor));
            AppConfig.CreateNode(xmlDoc, grad, "GradTime", "");
            AppConfig.CreateNode(xmlDoc, grad, "GradFlow", "");
            AppConfig.CreateNode(xmlDoc, grad, "GradPumpA", "");
            AppConfig.CreateNode(xmlDoc, grad, "GradPumpB", "");
            AppConfig.CreateNode(xmlDoc, grad, "GradPumpC", "");
            AppConfig.CreateNode(xmlDoc, grad, "GradPumpD", "");
            user.AppendChild(grad);

            try
            {
                xmlDoc.Save(path);
            }
            catch (Exception e)
            {
                ////显示错误信息
                //Console.WriteLine(e.Message);
            }
        }
Пример #2
0
        public bool NewPumpMethod(string path, string methodName)
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(path);
            XmlNode root = xmlDoc.ChildNodes[1];

            foreach (XmlNode node in root.ChildNodes)
            {
                if (methodName == node.Name)
                {
                    MessageBox.Show("已存在此配置", "新建配置", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    return(false);
                }
            }
            try
            {
                XmlNode user = xmlDoc.CreateNode(XmlNodeType.Element, methodName, null);
                root.AppendChild(user);
                XmlNode constant = xmlDoc.CreateNode(XmlNodeType.Element, "Constant", null);
                AppConfig.CreateNode(xmlDoc, constant, "ConstantFlow", (ConstantFlow_TextBox.Text = ""));
                AppConfig.CreateNode(xmlDoc, constant, "ConstantTime", (ConstantTime_TextBox.Text = ""));
                AppConfig.CreateNode(xmlDoc, constant, "ConstantPumpA", (ConstantPumpA_TextBox.Text = ""));
                AppConfig.CreateNode(xmlDoc, constant, "ConstantPumpB", (ConstantPumpB_TextBox.Text = ""));
                AppConfig.CreateNode(xmlDoc, constant, "ConstantPumpC", (ConstantPumpC_TextBox.Text = ""));
                AppConfig.CreateNode(xmlDoc, constant, "ConstantPumpD", (ConstantPumpD_TextBox.Text = ""));
                user.AppendChild(constant);
                XmlNode grad = xmlDoc.CreateNode(XmlNodeType.Element, "Gradient", null);
                AppConfig.CreateNode(xmlDoc, grad, "PumpACurvEn", (!(PumpA_Color.Checked = false)).ToString());
                AppConfig.CreateNode(xmlDoc, grad, "PumpBCurvEn", (!(PumpB_Color.Checked = false)).ToString());
                AppConfig.CreateNode(xmlDoc, grad, "PumpCCurvEn", (!(PumpC_Color.Checked = false)).ToString());
                AppConfig.CreateNode(xmlDoc, grad, "PumpDCurvEn", (!(PumpD_Color.Checked = false)).ToString());
                AppConfig.CreateNode(xmlDoc, grad, "PumpACurvColor", System.Drawing.ColorTranslator.ToHtml(PumpA_Color.BackColor));
                AppConfig.CreateNode(xmlDoc, grad, "PumpBCurvColor", System.Drawing.ColorTranslator.ToHtml(PumpB_Color.BackColor));
                AppConfig.CreateNode(xmlDoc, grad, "PumpCCurvColor", System.Drawing.ColorTranslator.ToHtml(PumpC_Color.BackColor));
                AppConfig.CreateNode(xmlDoc, grad, "PumpDCurvColor", System.Drawing.ColorTranslator.ToHtml(PumpD_Color.BackColor));
                AppConfig.CreateNode(xmlDoc, grad, "GradTime", "");
                AppConfig.CreateNode(xmlDoc, grad, "GradFlow", "");
                AppConfig.CreateNode(xmlDoc, grad, "GradPumpA", "");
                AppConfig.CreateNode(xmlDoc, grad, "GradPumpB", "");
                AppConfig.CreateNode(xmlDoc, grad, "GradPumpC", "");
                AppConfig.CreateNode(xmlDoc, grad, "GradPumpD", "");
                user.AppendChild(grad);

                xmlDoc.Save(path);
            }
            catch (Exception e)
            {
                ////显示错误信息
                //Console.WriteLine(e.Message);
                MessageBox.Show(e.Message, "新建配置", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                return(false);
            }
            return(true);
        }
Пример #3
0
        public void CreateCollectorXmlFile(string path)
        {
            if (File.Exists(path))
            {
                return;
            }

            XmlDocument xmlDoc = new XmlDocument();
            XmlNode     node   = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", "");

            xmlDoc.AppendChild(node);

            XmlNode root = xmlDoc.CreateElement("Method");

            xmlDoc.AppendChild(root);

            XmlNode config = xmlDoc.CreateNode(XmlNodeType.Element, "MethodConfig", null);

            AppConfig.CreateNode(xmlDoc, config, "LastMethodName", "默认");
            root.AppendChild(config);
            XmlNode user = xmlDoc.CreateNode(XmlNodeType.Element, "默认", null);

            AppConfig.CreateNode(xmlDoc, user, "ButtleVolume", (ButtleVolume_TextBox.Text = ""));
            AppConfig.CreateNode(xmlDoc, user, "PipeLength", (PipeLength_TextBox.Text = ""));
            AppConfig.CreateNode(xmlDoc, user, "PipeDiameter", (PipeDiameter_TextBox.Text = ""));
            AppConfig.CreateNode(xmlDoc, user, "CollectorProgram_MinPeakWidth", (CollectorProgram_MinPeakWidth_TextBox.Text = ""));
            AppConfig.CreateNode(xmlDoc, user, "StartButtleNo", (StartButtleNo_TextBox.Text = ""));
            AppConfig.CreateNode(xmlDoc, user, "StopButtleNo", (StopButtleNo_TextBox.Text = ""));
            AppConfig.CreateNode(xmlDoc, user, "StartFilter", "");
            AppConfig.CreateNode(xmlDoc, user, "StartTime", "");
            AppConfig.CreateNode(xmlDoc, user, "StartThreshold", "");
            AppConfig.CreateNode(xmlDoc, user, "StartSlope", "");
            AppConfig.CreateNode(xmlDoc, user, "StopFilter", "");
            AppConfig.CreateNode(xmlDoc, user, "StopTime", "");
            AppConfig.CreateNode(xmlDoc, user, "StopThreshold", "");
            AppConfig.CreateNode(xmlDoc, user, "StopSlope", "");
            AppConfig.CreateNode(xmlDoc, user, "MaxVolume", "");
            AppConfig.CreateNode(xmlDoc, user, "MaxTime", "");
            AppConfig.CreateNode(xmlDoc, user, "CollectorProgram_Channel", "");
            root.AppendChild(user);

            try
            {
                xmlDoc.Save(path);
            }
            catch (Exception e)
            {
                ////显示错误信息
                //Console.WriteLine(e.Message);
            }
        }
Пример #4
0
        public bool NewCollectorMethod(string path, string methodName)
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(path);
            XmlNode root = xmlDoc.ChildNodes[1];

            foreach (XmlNode node in root.ChildNodes)
            {
                if (methodName == node.Name)
                {
                    MessageBox.Show("已存在此配置", "新建配置", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    return(false);
                }
            }
            try
            {
                XmlNode user = xmlDoc.CreateNode(XmlNodeType.Element, methodName, null);
                AppConfig.CreateNode(xmlDoc, user, "ButtleVolume", (ButtleVolume_TextBox.Text = ""));
                AppConfig.CreateNode(xmlDoc, user, "PipeLength", (PipeLength_TextBox.Text = ""));
                AppConfig.CreateNode(xmlDoc, user, "PipeDiameter", (PipeDiameter_TextBox.Text = ""));
                AppConfig.CreateNode(xmlDoc, user, "CollectorProgram_MinPeakWidth", (CollectorProgram_MinPeakWidth_TextBox.Text = ""));
                AppConfig.CreateNode(xmlDoc, user, "StartButtleNo", (StartButtleNo_TextBox.Text = ""));
                AppConfig.CreateNode(xmlDoc, user, "StopButtleNo", (StopButtleNo_TextBox.Text = ""));
                AppConfig.CreateNode(xmlDoc, user, "StartFilter", "");
                AppConfig.CreateNode(xmlDoc, user, "StartTime", "");
                AppConfig.CreateNode(xmlDoc, user, "StartThreshold", "");
                AppConfig.CreateNode(xmlDoc, user, "StartSlope", "");
                AppConfig.CreateNode(xmlDoc, user, "StopFilter", "");
                AppConfig.CreateNode(xmlDoc, user, "StopTime", "");
                AppConfig.CreateNode(xmlDoc, user, "StopThreshold", "");
                AppConfig.CreateNode(xmlDoc, user, "StopSlope", "");
                AppConfig.CreateNode(xmlDoc, user, "MaxVolume", "");
                AppConfig.CreateNode(xmlDoc, user, "MaxTime", "");
                AppConfig.CreateNode(xmlDoc, user, "CollectorProgram_Channel", "");
                root.AppendChild(user);

                xmlDoc.Save(path);
            }
            catch (Exception e)
            {
                ////显示错误信息
                //Console.WriteLine(e.Message);
                MessageBox.Show(e.Message, "新建配置", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                return(false);
            }
            return(true);
        }
Пример #5
0
        public void CreateUVXmlFile(string path)
        {
            if (File.Exists(path))
            {
                return;
            }

            XmlDocument xmlDoc = new XmlDocument();
            XmlNode     node   = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", "");

            xmlDoc.AppendChild(node);

            XmlNode root = xmlDoc.CreateElement("Method");

            xmlDoc.AppendChild(root);

            XmlNode config = xmlDoc.CreateNode(XmlNodeType.Element, "MethodConfig", null);

            AppConfig.CreateNode(xmlDoc, config, "LastMethodName", "默认");
            root.AppendChild(config);
            XmlNode user = xmlDoc.CreateNode(XmlNodeType.Element, "默认", null);

            AppConfig.CreateNode(xmlDoc, user, "UVVPS", UVVPS_ComboBox.Text);
            AppConfig.CreateNode(xmlDoc, user, "UVAUUnit", UVAUUnit_ComboBox.Text);
            AppConfig.CreateNode(xmlDoc, user, "UVTimeUnit", UVTimeUnit_ComboBox.Text);
            AppConfig.CreateNode(xmlDoc, user, "UVMaxTime", UVMaxTime_TextBox.Text);
            AppConfig.CreateNode(xmlDoc, user, "UVWaveLength1", UVWaveLength1_TextBox.Text);
            AppConfig.CreateNode(xmlDoc, user, "UVWaveLength2", UVWaveLength2_TextBox.Text);
            AppConfig.CreateNode(xmlDoc, user, "UVWaveLength3", UVWaveLength3_TextBox.Text);
            AppConfig.CreateNode(xmlDoc, user, "UVCurv0Color", System.Drawing.ColorTranslator.ToHtml(UVWaveLength1Color_Set.BackColor));
            AppConfig.CreateNode(xmlDoc, user, "UVCurv1Color", System.Drawing.ColorTranslator.ToHtml(UVWaveLength2Color_Set.BackColor));
            AppConfig.CreateNode(xmlDoc, user, "UVCurv2Color", System.Drawing.ColorTranslator.ToHtml(UVWaveLength3Color_Set.BackColor));
            root.AppendChild(user);

            try
            {
                xmlDoc.Save(path);
            }
            catch (Exception e)
            {
                ////显示错误信息
                //Console.WriteLine(e.Message);
            }
        }
Пример #6
0
        public bool NewUVMethod(string path, string methodName)
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(path);
            XmlNode root = xmlDoc.ChildNodes[1];

            foreach (XmlNode node in root.ChildNodes)
            {
                if (methodName == node.Name)
                {
                    MessageBox.Show("已存在此配置", "新建配置", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    return(false);
                }
            }
            try
            {
                XmlNode user = xmlDoc.CreateNode(XmlNodeType.Element, methodName, null);
                AppConfig.CreateNode(xmlDoc, user, "UVVPS", UVVPS_ComboBox.Text);
                AppConfig.CreateNode(xmlDoc, user, "UVAUUnit", UVAUUnit_ComboBox.Text);
                AppConfig.CreateNode(xmlDoc, user, "UVTimeUnit", UVTimeUnit_ComboBox.Text);
                AppConfig.CreateNode(xmlDoc, user, "UVMaxTime", UVMaxTime_TextBox.Text);
                AppConfig.CreateNode(xmlDoc, user, "UVWaveLength1", UVWaveLength1_TextBox.Text);
                AppConfig.CreateNode(xmlDoc, user, "UVWaveLength2", UVWaveLength2_TextBox.Text);
                AppConfig.CreateNode(xmlDoc, user, "UVWaveLength3", UVWaveLength3_TextBox.Text);
                AppConfig.CreateNode(xmlDoc, user, "UVCurv0Color", System.Drawing.ColorTranslator.ToHtml(UVWaveLength1Color_Set.BackColor));
                AppConfig.CreateNode(xmlDoc, user, "UVCurv1Color", System.Drawing.ColorTranslator.ToHtml(UVWaveLength2Color_Set.BackColor));
                AppConfig.CreateNode(xmlDoc, user, "UVCurv2Color", System.Drawing.ColorTranslator.ToHtml(UVWaveLength3Color_Set.BackColor));
                root.AppendChild(user);
                xmlDoc.Save(path);
            }
            catch (Exception e)
            {
                ////显示错误信息
                //Console.WriteLine(e.Message);
                MessageBox.Show(e.Message, "新建配置", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                return(false);
            }
            return(true);
        }
Пример #7
0
        public bool NewMethodSnapShotMethod(string path, string methodName)
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(path);
            XmlNode root = xmlDoc.ChildNodes[1];

            foreach (XmlNode node in root.ChildNodes)
            {
                if (methodName == node.Name)
                {
                    MessageBox.Show("已存在此配置", "新建配置", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    return(false);
                }
            }
            try
            {
                XmlNode user = xmlDoc.CreateNode(XmlNodeType.Element, methodName, null);
                root.AppendChild(user);

                AppConfig.CreateNode(xmlDoc, user, "SaveTime", DateTime.Now.ToString("g"));

                XmlNode uv = xmlDoc.CreateNode(XmlNodeType.Element, "UV", null);
                AppConfig.CreateNode(xmlDoc, uv, "UVVPS", AppConfig.frmUV.GetUVVPS_ComboBox());
                AppConfig.CreateNode(xmlDoc, uv, "UVAUUnit", AppConfig.frmUV.GetUVAUUnit_ComboBox());
                AppConfig.CreateNode(xmlDoc, uv, "UVTimeUnit", AppConfig.frmUV.GetUVTimeUnit_ComboBox());
                AppConfig.CreateNode(xmlDoc, uv, "UVMaxTime", AppConfig.frmUV.GetUVMaxTime_TextBox());
                AppConfig.CreateNode(xmlDoc, uv, "UVWaveLength1", AppConfig.frmUV.GetUVWaveLength1_TextBox());
                AppConfig.CreateNode(xmlDoc, uv, "UVWaveLength2", AppConfig.frmUV.GetUVWaveLength2_TextBox());
                AppConfig.CreateNode(xmlDoc, uv, "UVWaveLength3", AppConfig.frmUV.GetUVWaveLength3_TextBox());
                AppConfig.CreateNode(xmlDoc, uv, "UVCurv0Color", AppConfig.frmUV.GetUVWaveLength1Color_Set());
                AppConfig.CreateNode(xmlDoc, uv, "UVCurv1Color", AppConfig.frmUV.GetUVWaveLength2Color_Set());
                AppConfig.CreateNode(xmlDoc, uv, "UVCurv2Color", AppConfig.frmUV.GetUVWaveLength3Color_Set());
                user.AppendChild(uv);

                XmlNode pump = xmlDoc.CreateNode(XmlNodeType.Element, "Pump", null);
                user.AppendChild(pump);
                XmlNode constant = xmlDoc.CreateNode(XmlNodeType.Element, "Constant", null);
                AppConfig.CreateNode(xmlDoc, constant, "ConstantFlow", AppConfig.frmPump.SetConstantFlow_TextBox(""));
                AppConfig.CreateNode(xmlDoc, constant, "ConstantTime", AppConfig.frmPump.SetConstantTime_TextBox(""));
                AppConfig.CreateNode(xmlDoc, constant, "ConstantPumpA", AppConfig.frmPump.SetConstantPumpA_TextBox(""));
                AppConfig.CreateNode(xmlDoc, constant, "ConstantPumpB", AppConfig.frmPump.SetConstantPumpB_TextBox(""));
                AppConfig.CreateNode(xmlDoc, constant, "ConstantPumpC", AppConfig.frmPump.SetConstantPumpC_TextBox(""));
                AppConfig.CreateNode(xmlDoc, constant, "ConstantPumpD", AppConfig.frmPump.SetConstantPumpD_TextBox(""));
                pump.AppendChild(constant);
                XmlNode grad = xmlDoc.CreateNode(XmlNodeType.Element, "Gradient", null);
                AppConfig.CreateNode(xmlDoc, grad, "PumpACurvEn", AppConfig.frmPump.SetPumpA_ColorChecked(false));
                AppConfig.CreateNode(xmlDoc, grad, "PumpBCurvEn", AppConfig.frmPump.SetPumpB_ColorChecked(false));
                AppConfig.CreateNode(xmlDoc, grad, "PumpCCurvEn", AppConfig.frmPump.SetPumpC_ColorChecked(false));
                AppConfig.CreateNode(xmlDoc, grad, "PumpDCurvEn", AppConfig.frmPump.SetPumpD_ColorChecked(false));
                AppConfig.CreateNode(xmlDoc, grad, "PumpACurvColor", AppConfig.frmPump.GetPumpA_Color());
                AppConfig.CreateNode(xmlDoc, grad, "PumpBCurvColor", AppConfig.frmPump.GetPumpB_Color());
                AppConfig.CreateNode(xmlDoc, grad, "PumpCCurvColor", AppConfig.frmPump.GetPumpC_Color());
                AppConfig.CreateNode(xmlDoc, grad, "PumpDCurvColor", AppConfig.frmPump.GetPumpD_Color());
                AppConfig.CreateNode(xmlDoc, grad, "GradTime", "");
                AppConfig.CreateNode(xmlDoc, grad, "GradFlow", "");
                AppConfig.CreateNode(xmlDoc, grad, "GradPumpA", "");
                AppConfig.CreateNode(xmlDoc, grad, "GradPumpB", "");
                AppConfig.CreateNode(xmlDoc, grad, "GradPumpC", "");
                AppConfig.CreateNode(xmlDoc, grad, "GradPumpD", "");
                pump.AppendChild(grad);

                XmlNode collector = xmlDoc.CreateNode(XmlNodeType.Element, "Collector", null);
                AppConfig.CreateNode(xmlDoc, collector, "ButtleVolume", AppConfig.frmCollector.SetButtleVolume_TextBox(""));
                AppConfig.CreateNode(xmlDoc, collector, "PipeLength", AppConfig.frmCollector.SetPipeLength_TextBox(""));
                AppConfig.CreateNode(xmlDoc, collector, "PipeDiameter", AppConfig.frmCollector.SetPipeDiameter_TextBox(""));
                AppConfig.CreateNode(xmlDoc, collector, "CollectorProgram_MinPeakWidth", AppConfig.frmCollector.SetCollectorProgram_MinPeakWidth_TextBox(""));
                AppConfig.CreateNode(xmlDoc, collector, "StartButtleNo", AppConfig.frmCollector.SetStartButtleNo_TextBox(""));
                AppConfig.CreateNode(xmlDoc, collector, "StopButtleNo", AppConfig.frmCollector.SetStopButtleNo_TextBox(""));
                AppConfig.CreateNode(xmlDoc, collector, "StartFilter", "");
                AppConfig.CreateNode(xmlDoc, collector, "StartTime", "");
                AppConfig.CreateNode(xmlDoc, collector, "StartThreshold", "");
                AppConfig.CreateNode(xmlDoc, collector, "StartSlope", "");
                AppConfig.CreateNode(xmlDoc, collector, "StopFilter", "");
                AppConfig.CreateNode(xmlDoc, collector, "StopTime", "");
                AppConfig.CreateNode(xmlDoc, collector, "StopThreshold", "");
                AppConfig.CreateNode(xmlDoc, collector, "StopSlope", "");
                AppConfig.CreateNode(xmlDoc, collector, "MaxVolume", "");
                AppConfig.CreateNode(xmlDoc, collector, "MaxTime", "");
                AppConfig.CreateNode(xmlDoc, collector, "CollectorProgram_Channel", "");
                user.AppendChild(collector);

                xmlDoc.Save(path);
            }
            catch (Exception e)
            {
                ////显示错误信息
                //Console.WriteLine(e.Message);
                MessageBox.Show(e.Message, "新建配置", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                return(false);
            }
            return(true);
        }
Пример #8
0
        public void CreateMethodSnapShotXmlFile(string path)
        {
            if (File.Exists(path))
            {
                return;
            }

            XmlDocument xmlDoc = new XmlDocument();
            XmlNode     node   = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", "");

            xmlDoc.AppendChild(node);

            XmlNode root = xmlDoc.CreateElement("Method");

            xmlDoc.AppendChild(root);

            XmlNode config = xmlDoc.CreateNode(XmlNodeType.Element, "MethodConfig", null);

            AppConfig.CreateNode(xmlDoc, config, "LastMethodName", "默认");
            root.AppendChild(config);
            XmlNode user = xmlDoc.CreateNode(XmlNodeType.Element, "默认", null);

            root.AppendChild(user);

            AppConfig.CreateNode(xmlDoc, user, "SaveTime", DateTime.Now.ToString("g"));

            XmlNode uv = xmlDoc.CreateNode(XmlNodeType.Element, "UV", null);

            AppConfig.CreateNode(xmlDoc, uv, "UVVPS", AppConfig.frmUV.GetUVVPS_ComboBox());
            AppConfig.CreateNode(xmlDoc, uv, "UVAUUnit", AppConfig.frmUV.GetUVAUUnit_ComboBox());
            AppConfig.CreateNode(xmlDoc, uv, "UVTimeUnit", AppConfig.frmUV.GetUVTimeUnit_ComboBox());
            AppConfig.CreateNode(xmlDoc, uv, "UVMaxTime", AppConfig.frmUV.GetUVMaxTime_TextBox());
            AppConfig.CreateNode(xmlDoc, uv, "UVWaveLength1", AppConfig.frmUV.GetUVWaveLength1_TextBox());
            AppConfig.CreateNode(xmlDoc, uv, "UVWaveLength2", AppConfig.frmUV.GetUVWaveLength2_TextBox());
            AppConfig.CreateNode(xmlDoc, uv, "UVWaveLength3", AppConfig.frmUV.GetUVWaveLength3_TextBox());
            AppConfig.CreateNode(xmlDoc, uv, "UVCurv0Color", AppConfig.frmUV.GetUVWaveLength1Color_Set());
            AppConfig.CreateNode(xmlDoc, uv, "UVCurv1Color", AppConfig.frmUV.GetUVWaveLength2Color_Set());
            AppConfig.CreateNode(xmlDoc, uv, "UVCurv2Color", AppConfig.frmUV.GetUVWaveLength3Color_Set());
            user.AppendChild(uv);

            XmlNode pump = xmlDoc.CreateNode(XmlNodeType.Element, "Pump", null);

            user.AppendChild(pump);
            XmlNode constant = xmlDoc.CreateNode(XmlNodeType.Element, "Constant", null);

            AppConfig.CreateNode(xmlDoc, constant, "ConstantFlow", AppConfig.frmPump.SetConstantFlow_TextBox(""));
            AppConfig.CreateNode(xmlDoc, constant, "ConstantTime", AppConfig.frmPump.SetConstantTime_TextBox(""));
            AppConfig.CreateNode(xmlDoc, constant, "ConstantPumpA", AppConfig.frmPump.SetConstantPumpA_TextBox(""));
            AppConfig.CreateNode(xmlDoc, constant, "ConstantPumpB", AppConfig.frmPump.SetConstantPumpB_TextBox(""));
            AppConfig.CreateNode(xmlDoc, constant, "ConstantPumpC", AppConfig.frmPump.SetConstantPumpC_TextBox(""));
            AppConfig.CreateNode(xmlDoc, constant, "ConstantPumpD", AppConfig.frmPump.SetConstantPumpD_TextBox(""));
            pump.AppendChild(constant);
            XmlNode grad = xmlDoc.CreateNode(XmlNodeType.Element, "Gradient", null);

            AppConfig.CreateNode(xmlDoc, grad, "PumpACurvEn", AppConfig.frmPump.SetPumpA_ColorChecked(false));
            AppConfig.CreateNode(xmlDoc, grad, "PumpBCurvEn", AppConfig.frmPump.SetPumpB_ColorChecked(false));
            AppConfig.CreateNode(xmlDoc, grad, "PumpCCurvEn", AppConfig.frmPump.SetPumpC_ColorChecked(false));
            AppConfig.CreateNode(xmlDoc, grad, "PumpDCurvEn", AppConfig.frmPump.SetPumpD_ColorChecked(false));
            AppConfig.CreateNode(xmlDoc, grad, "PumpACurvColor", AppConfig.frmPump.GetPumpA_Color());
            AppConfig.CreateNode(xmlDoc, grad, "PumpBCurvColor", AppConfig.frmPump.GetPumpB_Color());
            AppConfig.CreateNode(xmlDoc, grad, "PumpCCurvColor", AppConfig.frmPump.GetPumpC_Color());
            AppConfig.CreateNode(xmlDoc, grad, "PumpDCurvColor", AppConfig.frmPump.GetPumpD_Color());
            AppConfig.CreateNode(xmlDoc, grad, "GradTime", "");
            AppConfig.CreateNode(xmlDoc, grad, "GradFlow", "");
            AppConfig.CreateNode(xmlDoc, grad, "GradPumpA", "");
            AppConfig.CreateNode(xmlDoc, grad, "GradPumpB", "");
            AppConfig.CreateNode(xmlDoc, grad, "GradPumpC", "");
            AppConfig.CreateNode(xmlDoc, grad, "GradPumpD", "");
            pump.AppendChild(grad);

            XmlNode collector = xmlDoc.CreateNode(XmlNodeType.Element, "Collector", null);

            AppConfig.CreateNode(xmlDoc, collector, "ButtleVolume", AppConfig.frmCollector.SetButtleVolume_TextBox(""));
            AppConfig.CreateNode(xmlDoc, collector, "PipeLength", AppConfig.frmCollector.SetPipeLength_TextBox(""));
            AppConfig.CreateNode(xmlDoc, collector, "PipeDiameter", AppConfig.frmCollector.SetPipeDiameter_TextBox(""));
            AppConfig.CreateNode(xmlDoc, collector, "CollectorProgram_MinPeakWidth", AppConfig.frmCollector.SetCollectorProgram_MinPeakWidth_TextBox(""));
            AppConfig.CreateNode(xmlDoc, collector, "StartButtleNo", AppConfig.frmCollector.SetStartButtleNo_TextBox(""));
            AppConfig.CreateNode(xmlDoc, collector, "StopButtleNo", AppConfig.frmCollector.SetStopButtleNo_TextBox(""));
            AppConfig.CreateNode(xmlDoc, collector, "StartFilter", "");
            AppConfig.CreateNode(xmlDoc, collector, "StartTime", "");
            AppConfig.CreateNode(xmlDoc, collector, "StartThreshold", "");
            AppConfig.CreateNode(xmlDoc, collector, "StartSlope", "");
            AppConfig.CreateNode(xmlDoc, collector, "StopFilter", "");
            AppConfig.CreateNode(xmlDoc, collector, "StopTime", "");
            AppConfig.CreateNode(xmlDoc, collector, "StopThreshold", "");
            AppConfig.CreateNode(xmlDoc, collector, "StopSlope", "");
            AppConfig.CreateNode(xmlDoc, collector, "MaxVolume", "");
            AppConfig.CreateNode(xmlDoc, collector, "MaxTime", "");
            AppConfig.CreateNode(xmlDoc, collector, "CollectorProgram_Channel", "");
            user.AppendChild(collector);

            try
            {
                xmlDoc.Save(path);
            }
            catch (Exception e)
            {
                ////显示错误信息
                //Console.WriteLine(e.Message);
            }
        }