/// <summary> /// 如果不用简单工厂 /// </summary> /// <param name="str1"></param> private void button2_NoEncapsulation(string className) { string str1 = ""; if (className == "gps") { Gps e1 = new Gps(); str1 = e1.GetName(); Invoke(new show(showTextbox), new object[] { str1 }); } else { IMU e2 = new IMU(); str1 = e2.GetName(); Invoke(new show(showTextbox), new object[] { str1 }); } }