Search code examples
c#visual-studiopluginsadd-inenterprise-architect

Addin menu options are disabled after creating my own add-in


I did everything as the tutorialCREATE YOUR FIRST C# ENTERPRISE ARCHITECT ADD-IN IN 10 MINUTES, but after registry, I just can't click my addin, the button is grey. enter image description here

I tried to use EA installation Inspector, but everything is just fine.

enter image description here I am wondering if there is a chance that because my EA version is trial? Waiting for your help, thanks.


Solution

  • Thanks Geert for pointing in the right direction, the issue you face happens because of the multiple plugins interacting with each other during the booting up of EA. To resolve the "greying out" of your Addin you must replace this part of your code (for all your plugins):

        public object EA_GetMenuItems(EA.Repository Repository, string Location, string MenuName)
        {
                switch (MenuName)
                {
                    // defines the top level menu option
                    case "":
                        return menuHeader;
                    // defines the submenu options
                    case menuHeader:
                        string[] subMenus = { menuHello, menuGoodbye};
                        return subMenus;
                }
            return "";
        }
    

    with these following lines (for all your plugins respectively),

    for MyFirstAddin,

        public object EA_GetMenuItems(EA.Repository Repository, string Location, string MenuName)
        {
                switch (MenuName)
                {
                    // defines the top level menu option
                    case "":
                        return "-&MyFirstAddin";
                    // defines the submenu options
                    case "-&MyFirstAddin":
                        string[] subMenus = { menuHello, menuGoodbye};
                        return subMenus;
                }
            return "";
        }
    

    for TypeInfo

        public object EA_GetMenuItems(EA.Repository Repository, string Location, string MenuName)
        {
                switch (MenuName)
                {
                    // defines the top level menu option
                    case "":
                        return "-&TypeInfo";
                    // defines the submenu options
                    case "-&TypeInfo":
                        string[] subMenus = { menuHello, menuGoodbye};
                        return subMenus;
                }
            return "";
        }
    

    for MyDemoAdd-in

        public object EA_GetMenuItems(EA.Repository Repository, string Location, string MenuName)
        {
                switch (MenuName)
                {
                    // defines the top level menu option
                    case "":
                        return "-&MyDemoAdd-in";
                    // defines the submenu options
                    case "-&MyDemoAdd-in":
                        string[] subMenus = { menuHello, menuGoodbye};
                        return subMenus;
                }
            return "";
        }