Exemplo n.º 1
0
 public bool readCutMessageFromXML()
 {
     try
     {
         XmlDocument xmlDoc = new XmlDocument();
         xmlDoc.Load(GlobalVar.gl_ProjectName);
         XmlNode     root = xmlDoc.SelectSingleNode("Config");
         XmlNodeList list = root.ChildNodes;
         for (int i = 0; i < list.Count; i++)
         {
             string  model     = "";
             string  rang      = "";
             string  uppadress = "";
             string  dwnadress = "";
             string  uppvalue  = "";
             string  dwnvalue  = "";
             string  delaytime = "";
             string  number    = "";
             XmlNode PPCNode   = list[i];
             //先获取序号
             XmlNode Sequence = list[i].SelectSingleNode("Sequence");
             number = Sequence.InnerText;
             foreach (XmlNode subnode in PPCNode.ChildNodes)
             {
                 if (subnode.Name == "Testvalue")
                 {
                     XmlNode Barmodel = subnode.SelectSingleNode("Modeltest");
                     XmlNode Barrang  = subnode.SelectSingleNode("Testrang");
                     XmlNode Baruppad = subnode.SelectSingleNode("Adressupp");
                     XmlNode Bardwnad = subnode.SelectSingleNode("Adressdwn");
                     XmlNode BarDelay = subnode.SelectSingleNode("Delaytime");
                     XmlNode Baruppva = subnode.SelectSingleNode("Uppervalue");
                     XmlNode Bardwnva = subnode.SelectSingleNode("Downvalue");
                     model     = Barmodel.InnerText;
                     rang      = Barrang.InnerText;
                     uppadress = Baruppad.InnerText;
                     dwnadress = Bardwnad.InnerText;
                     delaytime = BarDelay.InnerText;
                     uppvalue  = Baruppva.InnerText;
                     dwnvalue  = Bardwnva.InnerText;
                     SetParamer setpara = new SetParamer();
                     setpara.Name  = "Number" + i;
                     setpara.Width = 543;
                     this.flowLayoutPanel1.Controls.Add(setpara);
                     setpara.LoadContrlovalue(model, rang, uppadress, dwnadress, delaytime, uppvalue, dwnvalue, number);
                     Thread.Sleep(10);
                 }
             }
         }
     }
     catch (Exception em)
     {
         MessageBox.Show("读取XML异常:" + em.Message);
         myfunction.writelog("读取XML异常");
         return(false);
     }
     return(true);
 }
Exemplo n.º 2
0
        private void btn_AddTestProject_Click(object sender, EventArgs e)
        {
            int        ControlCount = this.flowLayoutPanel1.Controls.Count;
            string     ControlName  = "Number" + ControlCount.ToString();
            SetParamer setpara      = new SetParamer();

            setpara.Name  = ControlName;
            setpara.Width = 543;
            this.flowLayoutPanel1.Controls.Add(setpara);
            setpara.modifybtnText("Test" + (ControlCount + 1));
        }
Exemplo n.º 3
0
        private void btn_addProject_Click(object sender, EventArgs e)
        {
            int    ControlCount = this.flowLayoutPanel1.Controls.Count;
            string ControlName  = "btn" + ControlCount.ToString();

            SetParamer setpara = new SetParamer();

            setpara.Name  = ControlName;
            setpara.Width = flowLayoutPanel1.Width - 30;
            this.flowLayoutPanel1.Controls.Add(setpara);
            //flowLayoutPanel1.Controls.SetChildIndex(setpara, 1);
            setpara.modifybtnText("测试项" + (ControlCount + 1));
            //Button button = new Button();
            //button.Name = ControlName;
            //button.Text = "测试项" + (ControlCount + 1);
            //button.Width = flowLayoutPanel1.Width - 30;
            //this.flowLayoutPanel1.Controls.Add(button);
        }