コード例 #1
0
 static void Main(string[] args)
 {
     pluginsManager = new PluginsManager();
     pluginsManager.Load("TestPlugin.dll", out key);
     RunTest();
     Console.ReadKey(false);
 }
コード例 #2
0
        /// <summary>
        /// 加载插件菜单
        /// </summary>
        private void LoadPlugins()
        {
            PluginsManager pluginsMgr = new PluginsManager();

            pluginsMgr.Load();
            if (pluginsMgr.Plugins != null && pluginsMgr.Plugins.Count > 0)
            {
                foreach (PluginGroupInfo group in pluginsMgr.Plugins)
                {
                    if (group.Plugins.Count > 0)
                    {
                        ToolStripMenuItem item = new ToolStripMenuItem()
                        {
                            Text = group.GroupText,
                            Tag  = group.GroupName
                        };
                        foreach (var plugin in group.Plugins)
                        {
                            ToolStripMenuItem subItem = new ToolStripMenuItem()
                            {
                                Text = plugin.Text
                            };
                            subItem.Tag    = plugin;
                            subItem.Click += new EventHandler(subItem_Click);
                            item.DropDownItems.Add(subItem);
                        }
                        menuTools.DropDownItems.Add(item);
                    }
                }
            }
        }