0

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.

Geert Bellekens
  • 12,788
  • 2
  • 23
  • 50
Van
  • 13
  • 4

2 Answers2

1

The fact that your menu options are visible in EA means that it works correctly.

Trial or not doesn't matter

The state of your menu options is determined in the method EA_GetMenuState

In this method you can set the state of the menu option. An example from my repository on github

    public override void EA_GetMenuState(EA.Repository Repository, string Location, string MenuName, string ItemName, ref bool IsEnabled, ref bool IsChecked)
    {
        if (IsProjectOpen(Repository))
        {
            switch (ItemName)
            {
                // define the state of the hello menu option
                case menuHello:
                    IsEnabled = shouldWeSayHello;
                    break;
                // define the state of the goodbye menu option
                case menuGoodbye:
                    IsEnabled = !shouldWeSayHello;
                    break;
                // Define the state of the MenuCreatePackage menu option: 
                // Enable this menu option if 1)There is a repository open and 2)there is a package selected.
                case menuCreatePackage:
                    IsEnabled = (Repository != null) && (this.model.selectedElement != null);
                    break;
                case menuOpenProperties:
                    IsEnabled = true;
                    break;
                // there shouldn't be any other, but just in case disable it.
                default:
                    IsEnabled = false;
                    break;
            }
        }
        else
        {
            // If no open project, disable all menu options
            IsEnabled = false;
        }
    }
Geert Bellekens
  • 12,788
  • 2
  • 23
  • 50
-2

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 "";
    }
Niramin
  • 38
  • 4