需求是这样的:
应用程序的所有菜单项名称是从一个文件如config.xml读取,每一个菜单子项对应的都是一个动态库,这个动态库名称也是从这个文件中读取.每次应用程序运行起来后就生成最新的菜单,点击相应的菜单子项就根据其对应的动态库去执行.这样,应用程序就如同一个平台,不管文件中怎样改变,这个应用程序平台不需要改变.应用程序平台及各动态库使用C#开发.
如何实现这个平台,请有经验者赐教!!
应用程序的所有菜单项名称是从一个文件如config.xml读取,每一个菜单子项对应的都是一个动态库,这个动态库名称也是从这个文件中读取.每次应用程序运行起来后就生成最新的菜单,点击相应的菜单子项就根据其对应的动态库去执行.这样,应用程序就如同一个平台,不管文件中怎样改变,这个应用程序平台不需要改变.应用程序平台及各动态库使用C#开发.
如何实现这个平台,请有经验者赐教!!
解决方案 »
- 新手问个关于ImageList控件问题。
- checkbox+textbox
- C#中通过选择单选按钮实现面板上内容的切换
- 抽象类中所有的方法自然也是抽象的吗?
- 使用FTPClient做个FTP上传功能,但不会显示进度条!
- 在.net下可以创建这样一个文件夹么?????????????????????
- 关于application的值的保持问题
- 不理解的意思,高分求助,解决马上给分
- 用C#的GDI画图,载体是imagebutton,不能确定图的数量,应该如何设计呢?
- 求一套WINFROM方面的gridview的列子看看(VS2005)
- 高分求把图片存到数据库中(C/S模式 WINFORM)
- 初学.net做项目时遇到的郁闷问题 100分求助
// LoadInvoke loads MyAssembly.dll and lists the method
// information for each method. After compiling this class,
// run LoadInvoke.exe with the DisplayName for the assembly,
// as shown here:
// LoadInvoke MyAssemblyusing System;
using System.Reflection;
using System.Security.Permissions;public class LoadInvoke
{
[PermissionSetAttribute(SecurityAction.Demand, Name="FullTrust")]
public static void Main(string[] args)
{
Assembly a = Assembly.Load(args[0]);
Type[] mytypes = a.GetTypes();
BindingFlags flags = (BindingFlags.NonPublic | BindingFlags.Public |
BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly); foreach(Type t in mytypes)
{
MethodInfo[] mi = t.GetMethods(flags);
Object obj = Activator.CreateInstance(t); foreach(MethodInfo m in mi)
{
// Instead of invoking the methods,
// it's safer to initially just list them.
Console.WriteLine(m);
}
}
}
}
C#
// Use this class with the LoadInvoke program.
// Compile this class using "csc /t:library MyAssembly.cs"
// to build MyAssembly.dll.
using System;public class MyAssembly
{
public void MyMethod1()
{
Console.WriteLine("This is MyMethod1");
}
public void MyMethod2()
{
Console.WriteLine("This is MyMethod2");
}
public void MyMethod3()
{
Console.WriteLine("This is MyMethod3");
}
}
有一个问题是如何使菜单项和相关动态库联系起来??
+= new EventHandle()
是使用这种方法么?具体怎么处理才能响应?
http://www.icsharpcode.net/
麻烦说清楚一些.