菜单模块的结构图如下:
菜单模块通过重载BuildMenuCore函数实现菜单项的加载。
namespace ztcad.ThCad { public class AdminMenu : AdminMenuProvider { protected override void BuildMenuCore(TreeNode<MenuItem> pluginsNode) { var menuItem = new MenuItem(); menuItem.Text = "我的插件"; var subMenuNode = pluginsNode.Prepend(menuItem); var subMenuItem = new MenuItem(); subMenuItem.Text = "测试一"; subMenuItem.ActionName = "test1"; subMenuNode.Append(subMenuItem); subMenuItem = new MenuItem(); subMenuItem.Text = "测试二"; subMenuItem.ActionName = "test2"; subMenuNode.Append(subMenuItem); } public override int Ordinal { get { return 100; } } } }