コード例 #1
0
        /*添加按钮事件,并且将各个参数作为para的一个属性,将para添加值list中*/
        private void add_Button_Click(object sender, EventArgs e)
        {
            paraName_tb = new TextBox();
            paraValue_tb = new TextBox();
            paraType_tb = new ComboBox();
            paraDataType_cb = new ComboBox();

            this.draw_Para_Component(paraName_tb, paraValue_tb, paraType_tb, paraDataType_cb, "读取", Main.f);

            para = new Para(paraName_tb, paraValue_tb, paraType_tb, paraDataType_cb);
            paraName_list.Add(para);
            paraName_list.TrimExcess();

            Main.f += 1;
        }
コード例 #2
0
        public void loadXmlFile()
        {
            myXmlDoc.Load(this.myXMLFilePath);

            XmlNode rootNode = myXmlDoc.SelectSingleNode("FlashResponse");

            XmlNodeList xnl = rootNode.ChildNodes;

            foreach (XmlNode xn in xnl)
            {
                XmlElement xe = (XmlElement)xn;

                if (xe.GetAttribute("id").ToString() == "1")
                {
                    XmlNode groupbox1_xn = xe.ChildNodes[0];
                    xe = (XmlElement)groupbox1_xn;
                    this.oPage.getKeyTextBox().Text = xe.GetAttribute("value");
                }
                else if (xe.GetAttribute("id").ToString() == "2")
                {
                    XmlNodeList groupbox2_xl = xn.ChildNodes;
                    xe = (XmlElement)groupbox2_xl[0];
                    this.oPage.getUrlTextBox().Text = xe.GetAttribute("value");
                    xe = (XmlElement)groupbox2_xl[1];

                    if (xe.GetAttribute("value") == "POST")
                    {
                        this.oPage.getRequestType_cb().SelectedIndex = 1;
                        xe = (XmlElement)groupbox2_xl[2];
                        this.oPage.getRequestCheckBox().Checked = Boolean.Parse(xe.GetAttribute("value"));
                        xe = (XmlElement)groupbox2_xl[3];
                        this.oPage.getResponseCheckBox().Checked = Boolean.Parse(xe.GetAttribute("value"));
                        xe = (XmlElement)groupbox2_xl[4];
                        this.oPage.add_requestbody_tb(xe.GetAttribute("value"));
                    }
                    else
                    {
                        this.oPage.getRequestType_cb().SelectedIndex = 0;
                        this.oPage.remove_requestbody_tb();
                        xe = (XmlElement)groupbox2_xl[2];
                        this.oPage.getRequestCheckBox().Checked = Boolean.Parse(xe.GetAttribute("value"));
                        xe = (XmlElement)groupbox2_xl[3];
                        this.oPage.getResponseCheckBox().Checked = Boolean.Parse(xe.GetAttribute("value"));
                    }
                }
                else if (xe.GetAttribute("id").ToString() == "json_groupbox")
                {
                    XmlNode json_groupbox_xn = xe.ChildNodes[0];
                    xe = (XmlElement)json_groupbox_xn;
                    this.oPage.getPreviewTextbox().Text = xe.GetAttribute("value");
                }
                else if (xe.GetAttribute("id").ToString() == "3")
                {
                    XmlNodeList groupbox3_xn = xn.ChildNodes;

                    this.oPage.getPara_list().Clear();

                    for (int i = 0; i < groupbox3_xn.Count; i++)
                    {
                        XmlElement paraElement = (XmlElement)groupbox3_xn[i];
                        XmlNodeList paraXml = paraElement.ChildNodes;
                        paraName_tb = new TextBox();
                        paraValue_tb = new TextBox();
                        paraType_tb = new ComboBox();
                        paraDataType_cb = new ComboBox();
                        Para para = new Para(paraName_tb, paraValue_tb, paraType_tb, paraDataType_cb);

                        para.getParaNameTextBox().Text = paraXml.Item(0).InnerText;
                        para.getParaValueTextBox().Text = paraXml.Item(1).InnerText;

                        para.getParaDataTypeComboBox().Text = paraXml.Item(3).InnerText;

                        this.oPage.draw_Para_Component(para.getParaNameTextBox(), para.getParaValueTextBox(), para.getParaTypeComboBox(), para.getParaDataTypeComboBox(),  paraXml.Item(2).InnerText, i);
                        Main.f++;
                        this.oPage.getPara_list().Add(para);
                        this.oPage.getPara_list().TrimExcess();
                    }
                }
                else if (xe.GetAttribute("id").ToString() == "sign_groupbox")
                {
                    XmlNode sign_groupbox_xn = xe.ChildNodes[0];
                    xe = (XmlElement)sign_groupbox_xn;
                    this.oPage.getSignValue_text().Text = xe.GetAttribute("value");
                }
                else if (xe.GetAttribute("id").ToString() == "4")
                {
                    XmlNode groupbox4_xn = xe.ChildNodes[0];
                    xe = (XmlElement)groupbox4_xn;
                    this.oPage.getResponse_ta().Text = xe.GetAttribute("value");
                }
            }
        }