//<lable title="lable" text="基础信息查询" type="lable" dll="InfoAdd.dll" class="InfoAdd.BackForm" method="Addform"/>
try {
Assembly a;
a = Assembly.LoadFile(Application.StartupPath + "\\" + xmlNode.Attributes["dll"].Value);
Type t = a.GetType(xmlNode.Attributes["class"].Value, false, true);
MethodInfo method = t.GetMethod(xmlNode.Attributes["method"].Value);
ConstructorInfo coninfo = t.GetConstructor(new Type[] { typeof(Form), typeof(XmlNode), typeof(string) });
object[] arg = new object[3] { mainForm, xmlNode, userId };
object obj = coninfo.Invoke(arg);
method.Invoke(obj, null);
}
catch (Exception ee)
{
MessageBox.Show(ee.ToString());
}
namespace InfoAdd
{
public class BackForm
{
public XmlNode xmlNode; //传入的节点
public string userId;
public Form mainForm;
public BackForm(Form mainForm, XmlNode xmlNode, string userId)
{
this.mainForm = mainForm;
this.xmlNode = xmlNode;
this.userId = userId;
}
public void Addform()
{
AddForm af = new AddForm();
af.MaximizeBox = false; //最大化取消
af.MdiParent = mainForm;
af.BringToFront();
af.Show();
}
}
}
try
{
Assembly a;
//不带变量 a = Assembly.LoadFile(Application.StartupPath + "\\" + xmlNode.Attributes["dll"].Value);
Type t = a.GetType(xmlNode.Attributes["class"].Value, false, true);
MethodInfo method = t.GetMethod(xmlNode.Attributes["method"].Value);
Object obj = Activator.CreateInstance(t);
method.Invoke(obj, null);
}
catch (Exception ee)
{
MessageBox.Show(ee.ToString());
}