Пример #1
0
        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));
            }
        }
Пример #2
0
 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);
                 }
             }
         }
     }
 }