/// <summary> /// 从插件方案中查找RibbonControl对应的插件,加载插件 /// </summary> /// <param name="ribbonCtrl"></param> /// <param name="pluginPlan"></param> /// <param name="cmdData">插件命令的传入参数,泛型对象</param> public static void LoadPlugins <TCmdData>(this RibbonControl ribbonCtrl, IPluginPlan pluginPlan, TCmdData cmdData) { var form = ribbonCtrl.FindForm(); var view = pluginPlan.QueryViews(form); //找到窗体对应的插件视图 var container = QueryContainer(view, ribbonCtrl); //找到控件对应的插件容器 container.LoadPluginContainer(ribbonCtrl); //向控件加载插件容器包含的插件 container.LoadPluginCommands(cmdData); //创建容器包含的插件对应的命令 }
/// <summary> /// 从插件方案中查找<see cref="MenuStrip"/>对应的插件,加载插件 /// </summary> /// <param name="menuStrip"></param> /// <param name="pluginPlan"></param> /// <param name="cmdData">插件命令的传入参数,泛型对象</param> public static void LoadPlugins <TCmdData>(this MenuStrip menuStrip, IPluginPlan pluginPlan, TCmdData cmdData) { var form = menuStrip.FindForm(); var view = pluginPlan.QueryViews(form); //找到窗体对应的插件视图 var container = QueryContainer(view, menuStrip); //找到控件对应的插件容器 menuStrip.LoadPluginContainer(container); //向控件加载插件容器包含的插件 container.LoadPluginCommands(cmdData); //创建容器包含的插件对应的命令 }