private void AddctionToMenu(PluginMenuExtension pluginExt, MenuExtensionUsagesAttribute usage) { ToolStripMenuItem sectionItem = GetSection(usage.section); if (sectionItem != null) { sectionItem.DropDownItems.Add(usage.name, null, (x, y) => executeProxy.Execute(pluginExt)); } }
public void LoadOperationsFromAssembly(Assembly asm) { foreach (Type type in asm.GetTypes()) { if (baseClassInterface.IsAssignableFrom(type) && typeof(PluginMenuExtension).IsAssignableFrom(type)) { MenuExtensionUsagesAttribute attrib = type.GetCustomAttribute(typeof(MenuExtensionUsagesAttribute), false) as MenuExtensionUsagesAttribute; if (attrib != null) { PluginMenuExtension opInstance = Activator.CreateInstance(type) as PluginMenuExtension; if (opInstance != null) { AddctionToMenu(opInstance, attrib); } } } } }
public void Execute(PluginMenuExtension ext) { ext.Execute(imgProvider); }