shim 8 years ago
parent
commit
f45a9d41ca

+ 10 - 379
UAS_DLLTest/Form1.Designer.cs

@@ -31,51 +31,20 @@
             this.groupBoxwithborder3 = new UAS_DLLTest.GroupBoxwithborder();
             this.operateResult = new System.Windows.Forms.RichTextBox();
             this.Parameters = new UAS_DLLTest.GroupBoxwithborder();
-            this.textBox9 = new System.Windows.Forms.TextBox();
-            this.textBox8 = new System.Windows.Forms.TextBox();
-            this.textBox7 = new System.Windows.Forms.TextBox();
-            this.textBox6 = new System.Windows.Forms.TextBox();
-            this.textBox5 = new System.Windows.Forms.TextBox();
-            this.textBox4 = new System.Windows.Forms.TextBox();
-            this.textBox3 = new System.Windows.Forms.TextBox();
-            this.textBox2 = new System.Windows.Forms.TextBox();
-            this.textBox1 = new System.Windows.Forms.TextBox();
-            this.label9 = new System.Windows.Forms.Label();
-            this.label8 = new System.Windows.Forms.Label();
-            this.label7 = new System.Windows.Forms.Label();
-            this.label6 = new System.Windows.Forms.Label();
-            this.label5 = new System.Windows.Forms.Label();
-            this.label4 = new System.Windows.Forms.Label();
-            this.label3 = new System.Windows.Forms.Label();
-            this.label2 = new System.Windows.Forms.Label();
-            this.label1 = new System.Windows.Forms.Label();
             this.clearResult = new System.Windows.Forms.CheckBox();
             this.clearPara = new System.Windows.Forms.CheckBox();
             this.clear = new System.Windows.Forms.Button();
             this.confirm = new System.Windows.Forms.Button();
             this.Methods = new UAS_DLLTest.GroupBoxwithborder();
-            this.SetPcbaData = new System.Windows.Forms.RadioButton();
-            this.GetMobileAllInfo = new System.Windows.Forms.RadioButton();
-            this.SetTestDetail = new System.Windows.Forms.RadioButton();
-            this.GetRcardMOInfo = new System.Windows.Forms.RadioButton();
-            this.SetMobileData = new System.Windows.Forms.RadioButton();
-            this.SetIMEIInfo = new System.Windows.Forms.RadioButton();
-            this.SetAddressInfo = new System.Windows.Forms.RadioButton();
-            this.CheckRoutePassed = new System.Windows.Forms.RadioButton();
-            this.GoMo = new System.Windows.Forms.RadioButton();
-            this.GetMEIOrNetCodeRange = new System.Windows.Forms.RadioButton();
-            this.GetAddressRangeByMO = new System.Windows.Forms.RadioButton();
-            this.CheckUserAndResourcePassed = new System.Windows.Forms.RadioButton();
             this.groupBoxwithborder3.SuspendLayout();
             this.Parameters.SuspendLayout();
-            this.Methods.SuspendLayout();
             this.SuspendLayout();
             // 
             // groupBoxwithborder3
             // 
             this.groupBoxwithborder3.BorderColor = System.Drawing.Color.Black;
             this.groupBoxwithborder3.Controls.Add(this.operateResult);
-            this.groupBoxwithborder3.Location = new System.Drawing.Point(34, 495);
+            this.groupBoxwithborder3.Location = new System.Drawing.Point(34, 494);
             this.groupBoxwithborder3.Name = "groupBoxwithborder3";
             this.groupBoxwithborder3.Size = new System.Drawing.Size(1219, 176);
             this.groupBoxwithborder3.TabIndex = 2;
@@ -94,184 +63,22 @@
             // Parameters
             // 
             this.Parameters.BorderColor = System.Drawing.Color.Black;
-            this.Parameters.Controls.Add(this.textBox9);
-            this.Parameters.Controls.Add(this.textBox8);
-            this.Parameters.Controls.Add(this.textBox7);
-            this.Parameters.Controls.Add(this.textBox6);
-            this.Parameters.Controls.Add(this.textBox5);
-            this.Parameters.Controls.Add(this.textBox4);
-            this.Parameters.Controls.Add(this.textBox3);
-            this.Parameters.Controls.Add(this.textBox2);
-            this.Parameters.Controls.Add(this.textBox1);
-            this.Parameters.Controls.Add(this.label9);
-            this.Parameters.Controls.Add(this.label8);
-            this.Parameters.Controls.Add(this.label7);
-            this.Parameters.Controls.Add(this.label6);
-            this.Parameters.Controls.Add(this.label5);
-            this.Parameters.Controls.Add(this.label4);
-            this.Parameters.Controls.Add(this.label3);
-            this.Parameters.Controls.Add(this.label2);
-            this.Parameters.Controls.Add(this.label1);
             this.Parameters.Controls.Add(this.clearResult);
             this.Parameters.Controls.Add(this.clearPara);
             this.Parameters.Controls.Add(this.clear);
             this.Parameters.Controls.Add(this.confirm);
-            this.Parameters.Location = new System.Drawing.Point(34, 201);
+            this.Parameters.Location = new System.Drawing.Point(34, 240);
             this.Parameters.Name = "Parameters";
-            this.Parameters.Size = new System.Drawing.Size(1219, 275);
+            this.Parameters.Size = new System.Drawing.Size(1219, 239);
             this.Parameters.TabIndex = 1;
             this.Parameters.TabStop = false;
             this.Parameters.Text = "Parameter";
             this.Parameters.TextColor = System.Drawing.Color.Black;
             // 
-            // textBox9
-            // 
-            this.textBox9.Location = new System.Drawing.Point(908, 124);
-            this.textBox9.Name = "textBox9";
-            this.textBox9.Size = new System.Drawing.Size(181, 28);
-            this.textBox9.TabIndex = 21;
-            // 
-            // textBox8
-            // 
-            this.textBox8.Location = new System.Drawing.Point(543, 121);
-            this.textBox8.Name = "textBox8";
-            this.textBox8.Size = new System.Drawing.Size(177, 28);
-            this.textBox8.TabIndex = 20;
-            // 
-            // textBox7
-            // 
-            this.textBox7.Location = new System.Drawing.Point(125, 121);
-            this.textBox7.Name = "textBox7";
-            this.textBox7.Size = new System.Drawing.Size(191, 28);
-            this.textBox7.TabIndex = 19;
-            // 
-            // textBox6
-            // 
-            this.textBox6.Location = new System.Drawing.Point(908, 76);
-            this.textBox6.Name = "textBox6";
-            this.textBox6.Size = new System.Drawing.Size(181, 28);
-            this.textBox6.TabIndex = 18;
-            // 
-            // textBox5
-            // 
-            this.textBox5.Location = new System.Drawing.Point(543, 76);
-            this.textBox5.Name = "textBox5";
-            this.textBox5.Size = new System.Drawing.Size(177, 28);
-            this.textBox5.TabIndex = 17;
-            // 
-            // textBox4
-            // 
-            this.textBox4.Location = new System.Drawing.Point(125, 76);
-            this.textBox4.Name = "textBox4";
-            this.textBox4.Size = new System.Drawing.Size(191, 28);
-            this.textBox4.TabIndex = 16;
-            // 
-            // textBox3
-            // 
-            this.textBox3.Location = new System.Drawing.Point(908, 32);
-            this.textBox3.Name = "textBox3";
-            this.textBox3.Size = new System.Drawing.Size(181, 28);
-            this.textBox3.TabIndex = 15;
-            // 
-            // textBox2
-            // 
-            this.textBox2.Location = new System.Drawing.Point(543, 33);
-            this.textBox2.Name = "textBox2";
-            this.textBox2.Size = new System.Drawing.Size(177, 28);
-            this.textBox2.TabIndex = 14;
-            // 
-            // textBox1
-            // 
-            this.textBox1.Location = new System.Drawing.Point(125, 33);
-            this.textBox1.Name = "textBox1";
-            this.textBox1.Size = new System.Drawing.Size(191, 28);
-            this.textBox1.TabIndex = 13;
-            // 
-            // label9
-            // 
-            this.label9.AutoSize = true;
-            this.label9.Location = new System.Drawing.Point(815, 131);
-            this.label9.Name = "label9";
-            this.label9.Size = new System.Drawing.Size(62, 18);
-            this.label9.TabIndex = 12;
-            this.label9.Text = "label9";
-            // 
-            // label8
-            // 
-            this.label8.AutoSize = true;
-            this.label8.Location = new System.Drawing.Point(450, 124);
-            this.label8.Name = "label8";
-            this.label8.Size = new System.Drawing.Size(62, 18);
-            this.label8.TabIndex = 11;
-            this.label8.Text = "label8";
-            // 
-            // label7
-            // 
-            this.label7.AutoSize = true;
-            this.label7.Location = new System.Drawing.Point(40, 127);
-            this.label7.Name = "label7";
-            this.label7.Size = new System.Drawing.Size(62, 18);
-            this.label7.TabIndex = 10;
-            this.label7.Text = "label7";
-            // 
-            // label6
-            // 
-            this.label6.AutoSize = true;
-            this.label6.Location = new System.Drawing.Point(815, 86);
-            this.label6.Name = "label6";
-            this.label6.Size = new System.Drawing.Size(62, 18);
-            this.label6.TabIndex = 9;
-            this.label6.Text = "label6";
-            // 
-            // label5
-            // 
-            this.label5.AutoSize = true;
-            this.label5.Location = new System.Drawing.Point(450, 79);
-            this.label5.Name = "label5";
-            this.label5.Size = new System.Drawing.Size(62, 18);
-            this.label5.TabIndex = 8;
-            this.label5.Text = "label5";
-            // 
-            // label4
-            // 
-            this.label4.AutoSize = true;
-            this.label4.Location = new System.Drawing.Point(40, 81);
-            this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(62, 18);
-            this.label4.TabIndex = 7;
-            this.label4.Text = "label4";
-            // 
-            // label3
-            // 
-            this.label3.AutoSize = true;
-            this.label3.Location = new System.Drawing.Point(815, 42);
-            this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(62, 18);
-            this.label3.TabIndex = 6;
-            this.label3.Text = "label3";
-            // 
-            // label2
-            // 
-            this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(450, 43);
-            this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(62, 18);
-            this.label2.TabIndex = 5;
-            this.label2.Text = "label2";
-            // 
-            // label1
-            // 
-            this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(40, 43);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(62, 18);
-            this.label1.TabIndex = 4;
-            this.label1.Text = "label1";
-            // 
             // clearResult
             // 
             this.clearResult.AutoSize = true;
-            this.clearResult.Location = new System.Drawing.Point(927, 226);
+            this.clearResult.Location = new System.Drawing.Point(928, 193);
             this.clearResult.Name = "clearResult";
             this.clearResult.Size = new System.Drawing.Size(133, 22);
             this.clearResult.TabIndex = 3;
@@ -281,7 +88,7 @@
             // clearPara
             // 
             this.clearPara.AutoSize = true;
-            this.clearPara.Location = new System.Drawing.Point(799, 226);
+            this.clearPara.Location = new System.Drawing.Point(800, 193);
             this.clearPara.Name = "clearPara";
             this.clearPara.Size = new System.Drawing.Size(115, 22);
             this.clearPara.TabIndex = 2;
@@ -290,7 +97,7 @@
             // 
             // clear
             // 
-            this.clear.Location = new System.Drawing.Point(593, 218);
+            this.clear.Location = new System.Drawing.Point(594, 185);
             this.clear.Name = "clear";
             this.clear.Size = new System.Drawing.Size(92, 36);
             this.clear.TabIndex = 1;
@@ -300,7 +107,7 @@
             // 
             // confirm
             // 
-            this.confirm.Location = new System.Drawing.Point(453, 218);
+            this.confirm.Location = new System.Drawing.Point(454, 185);
             this.confirm.Name = "confirm";
             this.confirm.Size = new System.Drawing.Size(94, 36);
             this.confirm.TabIndex = 0;
@@ -311,163 +118,19 @@
             // Methods
             // 
             this.Methods.BorderColor = System.Drawing.Color.Black;
-            this.Methods.Controls.Add(this.SetPcbaData);
-            this.Methods.Controls.Add(this.GetMobileAllInfo);
-            this.Methods.Controls.Add(this.SetTestDetail);
-            this.Methods.Controls.Add(this.GetRcardMOInfo);
-            this.Methods.Controls.Add(this.SetMobileData);
-            this.Methods.Controls.Add(this.SetIMEIInfo);
-            this.Methods.Controls.Add(this.SetAddressInfo);
-            this.Methods.Controls.Add(this.CheckRoutePassed);
-            this.Methods.Controls.Add(this.GoMo);
-            this.Methods.Controls.Add(this.GetMEIOrNetCodeRange);
-            this.Methods.Controls.Add(this.GetAddressRangeByMO);
-            this.Methods.Controls.Add(this.CheckUserAndResourcePassed);
-            this.Methods.Location = new System.Drawing.Point(34, 24);
+            this.Methods.Location = new System.Drawing.Point(34, 12);
             this.Methods.Name = "Methods";
-            this.Methods.Size = new System.Drawing.Size(1219, 151);
+            this.Methods.Size = new System.Drawing.Size(1219, 222);
             this.Methods.TabIndex = 0;
             this.Methods.TabStop = false;
             this.Methods.Text = "Method";
             this.Methods.TextColor = System.Drawing.Color.Black;
             // 
-            // SetPcbaData
-            // 
-            this.SetPcbaData.AutoSize = true;
-            this.SetPcbaData.Location = new System.Drawing.Point(440, 111);
-            this.SetPcbaData.Name = "SetPcbaData";
-            this.SetPcbaData.Size = new System.Drawing.Size(258, 22);
-            this.SetPcbaData.TabIndex = 13;
-            this.SetPcbaData.TabStop = true;
-            this.SetPcbaData.Text = "SetPcbaData(PCBA校准测试)";
-            this.SetPcbaData.UseVisualStyleBackColor = true;
-            // 
-            // GetMobileAllInfo
-            // 
-            this.GetMobileAllInfo.AutoSize = true;
-            this.GetMobileAllInfo.Location = new System.Drawing.Point(790, 83);
-            this.GetMobileAllInfo.Name = "GetMobileAllInfo";
-            this.GetMobileAllInfo.Size = new System.Drawing.Size(303, 22);
-            this.GetMobileAllInfo.TabIndex = 12;
-            this.GetMobileAllInfo.TabStop = true;
-            this.GetMobileAllInfo.Text = "GetMobileAllInfo(获取手机信息)";
-            this.GetMobileAllInfo.UseVisualStyleBackColor = true;
-            // 
-            // SetTestDetail
-            // 
-            this.SetTestDetail.AutoSize = true;
-            this.SetTestDetail.Location = new System.Drawing.Point(790, 55);
-            this.SetTestDetail.Name = "SetTestDetail";
-            this.SetTestDetail.Size = new System.Drawing.Size(276, 22);
-            this.SetTestDetail.TabIndex = 11;
-            this.SetTestDetail.TabStop = true;
-            this.SetTestDetail.Text = "SetTestDetail(记录测试结果)";
-            this.SetTestDetail.UseVisualStyleBackColor = true;
-            // 
-            // GetRcardMOInfo
-            // 
-            this.GetRcardMOInfo.AutoSize = true;
-            this.GetRcardMOInfo.Location = new System.Drawing.Point(790, 28);
-            this.GetRcardMOInfo.Name = "GetRcardMOInfo";
-            this.GetRcardMOInfo.Size = new System.Drawing.Size(285, 22);
-            this.GetRcardMOInfo.TabIndex = 10;
-            this.GetRcardMOInfo.TabStop = true;
-            this.GetRcardMOInfo.Text = "GetRcardMOInfo(获取工单信息)";
-            this.GetRcardMOInfo.UseVisualStyleBackColor = true;
-            // 
-            // SetMobileData
-            // 
-            this.SetMobileData.AutoSize = true;
-            this.SetMobileData.Location = new System.Drawing.Point(33, 111);
-            this.SetMobileData.Name = "SetMobileData";
-            this.SetMobileData.Size = new System.Drawing.Size(321, 22);
-            this.SetMobileData.TabIndex = 9;
-            this.SetMobileData.TabStop = true;
-            this.SetMobileData.Text = "SetMobileData(接收生产数据,转号)";
-            this.SetMobileData.UseVisualStyleBackColor = true;
-            // 
-            // SetIMEIInfo
-            // 
-            this.SetIMEIInfo.AutoSize = true;
-            this.SetIMEIInfo.Location = new System.Drawing.Point(440, 83);
-            this.SetIMEIInfo.Name = "SetIMEIInfo";
-            this.SetIMEIInfo.Size = new System.Drawing.Size(258, 22);
-            this.SetIMEIInfo.TabIndex = 8;
-            this.SetIMEIInfo.TabStop = true;
-            this.SetIMEIInfo.Text = "SetIMEIInfo(记录IMEI使用)";
-            this.SetIMEIInfo.UseVisualStyleBackColor = true;
-            // 
-            // SetAddressInfo
-            // 
-            this.SetAddressInfo.AutoSize = true;
-            this.SetAddressInfo.Location = new System.Drawing.Point(440, 55);
-            this.SetAddressInfo.Name = "SetAddressInfo";
-            this.SetAddressInfo.Size = new System.Drawing.Size(294, 22);
-            this.SetAddressInfo.TabIndex = 7;
-            this.SetAddressInfo.TabStop = true;
-            this.SetAddressInfo.Text = "SetAddressInfo(记录MACBT使用)";
-            this.SetAddressInfo.UseVisualStyleBackColor = true;
-            // 
-            // CheckRoutePassed
-            // 
-            this.CheckRoutePassed.AutoSize = true;
-            this.CheckRoutePassed.Location = new System.Drawing.Point(440, 27);
-            this.CheckRoutePassed.Name = "CheckRoutePassed";
-            this.CheckRoutePassed.Size = new System.Drawing.Size(267, 22);
-            this.CheckRoutePassed.TabIndex = 6;
-            this.CheckRoutePassed.TabStop = true;
-            this.CheckRoutePassed.Text = "CheckRoutePassed(检查途程)";
-            this.CheckRoutePassed.UseVisualStyleBackColor = true;
-            // 
-            // GoMo
-            // 
-            this.GoMo.AutoSize = true;
-            this.GoMo.Location = new System.Drawing.Point(790, 111);
-            this.GoMo.Name = "GoMo";
-            this.GoMo.Size = new System.Drawing.Size(159, 22);
-            this.GoMo.TabIndex = 5;
-            this.GoMo.TabStop = true;
-            this.GoMo.Text = "GoMo(归属工单)";
-            this.GoMo.UseVisualStyleBackColor = true;
-            // 
-            // GetMEIOrNetCodeRange
-            // 
-            this.GetMEIOrNetCodeRange.AutoSize = true;
-            this.GetMEIOrNetCodeRange.Location = new System.Drawing.Point(33, 83);
-            this.GetMEIOrNetCodeRange.Name = "GetMEIOrNetCodeRange";
-            this.GetMEIOrNetCodeRange.Size = new System.Drawing.Size(303, 22);
-            this.GetMEIOrNetCodeRange.TabIndex = 3;
-            this.GetMEIOrNetCodeRange.TabStop = true;
-            this.GetMEIOrNetCodeRange.Text = "GetMEIOrNetCodeRange(分配IMEI)";
-            this.GetMEIOrNetCodeRange.UseVisualStyleBackColor = true;
-            // 
-            // GetAddressRangeByMO
-            // 
-            this.GetAddressRangeByMO.AutoSize = true;
-            this.GetAddressRangeByMO.Location = new System.Drawing.Point(33, 55);
-            this.GetAddressRangeByMO.Name = "GetAddressRangeByMO";
-            this.GetAddressRangeByMO.Size = new System.Drawing.Size(303, 22);
-            this.GetAddressRangeByMO.TabIndex = 2;
-            this.GetAddressRangeByMO.TabStop = true;
-            this.GetAddressRangeByMO.Text = "GetAddressRangeByMO(分配MACBT)";
-            this.GetAddressRangeByMO.UseVisualStyleBackColor = true;
-            // 
-            // CheckUserAndResourcePassed
-            // 
-            this.CheckUserAndResourcePassed.AutoSize = true;
-            this.CheckUserAndResourcePassed.Location = new System.Drawing.Point(33, 27);
-            this.CheckUserAndResourcePassed.Name = "CheckUserAndResourcePassed";
-            this.CheckUserAndResourcePassed.Size = new System.Drawing.Size(357, 22);
-            this.CheckUserAndResourcePassed.TabIndex = 1;
-            this.CheckUserAndResourcePassed.TabStop = true;
-            this.CheckUserAndResourcePassed.Text = "CheckUserAndResourcePassed(登录检查)";
-            this.CheckUserAndResourcePassed.UseVisualStyleBackColor = true;
-            // 
             // Form1
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1285, 686);
+            this.ClientSize = new System.Drawing.Size(1285, 684);
             this.Controls.Add(this.groupBoxwithborder3);
             this.Controls.Add(this.Parameters);
             this.Controls.Add(this.Methods);
@@ -477,8 +140,6 @@
             this.groupBoxwithborder3.ResumeLayout(false);
             this.Parameters.ResumeLayout(false);
             this.Parameters.PerformLayout();
-            this.Methods.ResumeLayout(false);
-            this.Methods.PerformLayout();
             this.ResumeLayout(false);
 
         }
@@ -486,42 +147,12 @@
         #endregion
 
         private GroupBoxwithborder Methods;
-        private System.Windows.Forms.RadioButton SetPcbaData;
-        private System.Windows.Forms.RadioButton GetMobileAllInfo;
-        private System.Windows.Forms.RadioButton SetTestDetail;
-        private System.Windows.Forms.RadioButton GetRcardMOInfo;
-        private System.Windows.Forms.RadioButton SetMobileData;
-        private System.Windows.Forms.RadioButton SetIMEIInfo;
-        private System.Windows.Forms.RadioButton SetAddressInfo;
-        private System.Windows.Forms.RadioButton CheckRoutePassed;
-        private System.Windows.Forms.RadioButton GoMo;
-        private System.Windows.Forms.RadioButton GetMEIOrNetCodeRange;
-        private System.Windows.Forms.RadioButton GetAddressRangeByMO;
-        private System.Windows.Forms.RadioButton CheckUserAndResourcePassed;
         private GroupBoxwithborder Parameters;
         private GroupBoxwithborder groupBoxwithborder3;
         private System.Windows.Forms.CheckBox clearResult;
         private System.Windows.Forms.CheckBox clearPara;
         private System.Windows.Forms.Button clear;
         private System.Windows.Forms.Button confirm;
-        private System.Windows.Forms.TextBox textBox9;
-        private System.Windows.Forms.TextBox textBox8;
-        private System.Windows.Forms.TextBox textBox7;
-        private System.Windows.Forms.TextBox textBox6;
-        private System.Windows.Forms.TextBox textBox5;
-        private System.Windows.Forms.TextBox textBox4;
-        private System.Windows.Forms.TextBox textBox3;
-        private System.Windows.Forms.TextBox textBox2;
-        private System.Windows.Forms.TextBox textBox1;
-        private System.Windows.Forms.Label label9;
-        private System.Windows.Forms.Label label8;
-        private System.Windows.Forms.Label label7;
-        private System.Windows.Forms.Label label6;
-        private System.Windows.Forms.Label label5;
-        private System.Windows.Forms.Label label4;
-        private System.Windows.Forms.Label label3;
-        private System.Windows.Forms.Label label2;
-        private System.Windows.Forms.Label label1;
         private System.Windows.Forms.RichTextBox operateResult;
     }
 }

+ 61 - 46
UAS_DLLTest/Form1.cs

@@ -15,70 +15,61 @@ namespace UAS_DLLTest
     public partial class Form1 : Form
     {
         MESHelper helper;
-        Control.ControlCollection collection;
-        Control.ControlCollection groupBox2Childs;
+        Control.ControlCollection methodCollection;
+        Control.ControlCollection ParamCollection;
         ParameterInfo[] param;
         List<string> outParams = new List<string>();
         object[] allParams;
         int icount = 0;
+        Queue<Control> query = new Queue<Control>();//临时存储获取到的control控件
+        MethodInfo[] method;
         public Form1()
         {
             InitializeComponent();
             helper = new MESHelper();
-            collection = Methods.Controls;
-            groupBox2Childs = Parameters.Controls;
-            //监听多个radiobutton的状态
-            for (int i = 0; i < collection.Count; i++)
-            {
-                if (collection[i] is RadioButton)
-                {
-                    ((RadioButton)collection[i]).CheckedChanged+= new EventHandler(radioButton_checkChanged);
-                }
-            }
+            methodCollection = Methods.Controls;
+            ParamCollection = Parameters.Controls;
         }
 
         private void radioButton_checkChanged(object sender, EventArgs e)
         {
-            hideControl();
-            for (int i = 0; i < collection.Count; i++)
+            removeControl();
+            for (int i = 0; i < methodCollection.Count; i++)
             {
-                if (((RadioButton)collection[i]).Checked) {
+                if (((RadioButton)methodCollection[i]).Checked)
+                {
                     //显示当前选中的方法的所有参数
                     //获取所有的参数
                     icount = 0;
-                    param = helper.GetType().GetMethod(collection[i].Name).GetParameters();
+                    param = helper.GetType().GetMethod(methodCollection[i].Name).GetParameters();
                     for (int j = 1; j < param.Length+1; j++)
                     {
                         //参数名i开头的才需要显示
                         if (!param[j - 1].Name.StartsWith("o"))
                         {
                             icount += 1;
-                            //设置显示参数
-                            for (int k = 0; k < groupBox2Childs.Count; k++)
-                            {
-                                if (groupBox2Childs[k].Name == "label" + j)
-                                {
-                                    groupBox2Childs[k].Text = param[j - 1].Name;
-                                    groupBox2Childs[k].Visible = true;
-                                }
-                                else if (groupBox2Childs[k].Name == "textBox" + j)
-                                {
-                                    groupBox2Childs[k].Visible = true;
-                                }
-                            }
+                            ParamControl paramControl = new ParamControl();
+                            paramControl.paramsName = param[j - 1].Name;
+                            paramControl.paramsValueName= param[j - 1].Name;
+                            paramControl.Anchor= AnchorStyles.Left;
+                            paramControl.Anchor = AnchorStyles.Top;
+                            paramControl.Location = new Point((Parameters.Width/3-paramControl.Width)/2+((j-1)%3)*(Parameters.Width / 3),15+((j-1)/3)*(paramControl.Height+10));
+                            Parameters.Controls.Add(paramControl);
                         }
                     }
                     allParams = new object[param.Length];
                 }
             }
+            //重新获取控件
+            ParamCollection = Parameters.Controls;
         }
 
         private void confirm_Click(object sender, EventArgs e)
         {
             //拿到所有已经填写的参数
-            for (int i = 0; i < groupBox2Childs.Count; i++)
+            for (int i = 0; i < ParamCollection.Count; i++)
             {
-                for (int j = 1; j < allParams.Length; j++)
+                for (int j = 1; j < allParams.Length+1; j++)
                 {
                     if (j > icount)
                     {
@@ -86,15 +77,15 @@ namespace UAS_DLLTest
                     }
                     else
                     {
-                        if (groupBox2Childs[i].Name == "textBox" + j)
+                        if (ParamCollection[i] is ParamControl&& ((ParamControl)ParamCollection[i]).paramsValueName==param[j-1].Name)
                         {
                             if (param[j - 1].ParameterType.ToString()!= "System.String[]")
                             {
-                                allParams[j - 1] = ((TextBox)groupBox2Childs[i]).Text;
+                                allParams[j - 1] = ((ParamControl)ParamCollection[i]).paramsValue;
                             }
                             else
                             {
-                                allParams[j - 1] = ((TextBox)groupBox2Childs[i]).Text.Split(',');
+                                allParams[j - 1] = ((ParamControl)ParamCollection[i]).paramsValue.Split(',');
                             }
                         }
                     }
@@ -103,11 +94,11 @@ namespace UAS_DLLTest
             //将out类型的参数放进去
             string oResult = "";
             //拿到需要触发的方法名
-            for (int i = 0; i < collection.Count; i++) {
-                if (((RadioButton)collection[i]).Checked)
+            for (int i = 0; i < methodCollection.Count; i++) {
+                if (((RadioButton)methodCollection[i]).Checked)
                 {
                     Type type = helper.GetType();
-                    MethodInfo method =  type.GetMethod(((RadioButton)collection[i]).Name);
+                    MethodInfo method =  type.GetMethod(((RadioButton)methodCollection[i]).Name);
                     oResult = method.Invoke(helper, allParams).ToString();
                 }
             }
@@ -123,16 +114,33 @@ namespace UAS_DLLTest
 
         private void Form1_Load(object sender, EventArgs e)
         {
-            hideControl();
+            //动态生成checkBox
+            method = helper.GetType().GetMethods();
+            for (int i=0;i<method.Length;i++) {
+                //判断是否需要显示
+                if ((method[i].GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute) == null)
+                {
+                    continue;
+                }
+                RadioButton btn = new RadioButton();
+                btn.Name = method[i].Name;
+                btn.Text= method[i].Name;
+                btn.Anchor = AnchorStyles.Left;
+                btn.Anchor = AnchorStyles.Top;
+                btn.AutoSize = true;
+                btn.Location = new Point((Methods.Width / 3 - btn.Width) / 2 + (i % 3) * (Methods.Width / 3), 12 + (i / 3) * (btn.Height +0));
+                Methods.Controls.Add(btn);
+                btn.CheckedChanged += new EventHandler(radioButton_checkChanged);
+            }
         }
 
         private void clear_Click(object sender, EventArgs e)
         {
             //清除信息
             if (clearPara.Checked) {
-                for (int i=0;i<groupBox2Childs.Count;i++) {
-                    if (groupBox2Childs[i] is TextBox) {
-                        ((TextBox)groupBox2Childs[i]).Text = "";
+                for (int i=0;i< ParamCollection.Count;i++) {
+                    if (ParamCollection[i] is ParamControl) {
+                        ((ParamControl)ParamCollection[i]).paramsValue = "";
                     }
                 }
             }
@@ -141,16 +149,23 @@ namespace UAS_DLLTest
                 operateResult.Clear();
             }
         }
-        private void hideControl()
+        /// <summary>
+        /// 移除所有控件
+        /// </summary>
+        private void removeControl()
         {
-            //设置groupBox2中所有的label和textbox不可见
-            for (int i = 0; i < groupBox2Childs.Count; i++)
+            //移除所有ParamControl控件
+            foreach (Control c in this.Parameters.Controls)
             {
-                if ((groupBox2Childs[i] is Label) || (groupBox2Childs[i] is TextBox))
+                if (c is ParamControl)
                 {
-                    groupBox2Childs[i].Visible = false;
+                    query.Enqueue(c);
                 }
             }
+            while (query.Count != 0)
+            {
+                query.Dequeue().Dispose();
+            }
         }
     }
 }

+ 35 - 0
UAS_DLLTest/ParamControl.cs

@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace UAS_DLLTest
+{
+    public partial class ParamControl : UserControl
+    {
+        public ParamControl()
+        {
+            InitializeComponent();
+        }
+        public string paramsValue
+        {
+            get { return paramValue.Text; }
+            set { paramValue.Text = value; }
+        }
+        public string paramsName
+        {
+            get { return paramName.Text; }
+            set { paramName.Text = value; }
+        }
+        public string paramsValueName
+        {
+            get { return paramValue.Name; }
+            set { paramValue.Name = value; }
+        }
+    }
+}

+ 70 - 0
UAS_DLLTest/paramControl.Designer.cs

@@ -0,0 +1,70 @@
+namespace UAS_DLLTest
+{
+    partial class ParamControl
+    {
+        /// <summary> 
+        /// 必需的设计器变量。
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// 清理所有正在使用的资源。
+        /// </summary>
+        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region 组件设计器生成的代码
+
+        /// <summary> 
+        /// 设计器支持所需的方法 - 不要修改
+        /// 使用代码编辑器修改此方法的内容。
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.paramName = new System.Windows.Forms.Label();
+            this.paramValue = new System.Windows.Forms.TextBox();
+            this.SuspendLayout();
+            // 
+            // paramName
+            // 
+            this.paramName.AutoSize = true;
+            this.paramName.Location = new System.Drawing.Point(3, 11);
+            this.paramName.Name = "paramName";
+            this.paramName.Size = new System.Drawing.Size(62, 18);
+            this.paramName.TabIndex = 0;
+            this.paramName.Text = "label1";
+            this.paramName.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
+            // 
+            // paramValue
+            // 
+            this.paramValue.Location = new System.Drawing.Point(110, 1);
+            this.paramValue.Name = "paramValue";
+            this.paramValue.Size = new System.Drawing.Size(205, 28);
+            this.paramValue.TabIndex = 1;
+            // 
+            // ParamControl
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Controls.Add(this.paramValue);
+            this.Controls.Add(this.paramName);
+            this.Name = "ParamControl";
+            this.Size = new System.Drawing.Size(354, 32);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Label paramName;
+        private System.Windows.Forms.TextBox paramValue;
+    }
+}

+ 120 - 0
UAS_DLLTest/paramControl.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>