Hi Geert, thanks for the swift help!
Below is the entire code just one short class
Here is the .reg file text
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Sparx Systems\EAAddins\EETestAddin2]
@="EETestAddin2.Main"
Which creates
(default) sz EETestAddin2.Main prefixed with the Ab Symbol
Identical to the other working entries for my other working addins
I can't get it working though visual studio either. I'm not sure how to get Visual studio to register it for me other than through the project setting I mentioned in the previous post. Maybe that's the problem?
using System;
using System.Windows.Forms;
using EA;
namespace EETestAddin2
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class Main
{
private bool m_ShowFullMenus = false;
public String EA_Connect(EA.Repository Repository)
{
// No special processing req'd
return "";
}
public void EA_ShowHelp(EA.Repository Repository, string Location, string MenuName, string ItemName)
{
MessageBox.Show("Help for: " + MenuName + "/" + ItemName);
}
public object EA_GetMenuItems(EA.Repository Repository, string Location, string MenuName)
{
/* nb example of out parameter:
object item;
EA.ObjectType t = Repository.GetTreeSelectedItem(out item);
EA.Package r = (EA.Package) item;
*/
switch( MenuName )
{
case "":
return "-&Hello Everyone everywhere";
case "-&Hello Everyone everywhere":
string[] ar = { "&Packages", "Packages and &Elements", "-", "Show All &Options" };
return ar;
}
return "";
}
bool IsProjectOpen(EA.Repository Repository)
{
try
{
EA.Collection c = Repository.Models;
return true;
}
catch
{
return false;
}
}
public void EA_GetMenuState(EA.Repository Repository, string Location, string MenuName, string ItemName, ref bool IsEnabled, ref bool IsChecked)
{
if( IsProjectOpen(Repository) )
{
if( ItemName == "Show All &Options" )
IsChecked = m_ShowFullMenus;
else if( ItemName == "Packages and &Elements")
IsEnabled = m_ShowFullMenus;
}
else
// If no open project, disable all menu options
IsEnabled = false;
}
public void EA_MenuClick(EA.Repository Repository, string Location, string MenuName, string ItemName)
{
//frmModel f;
switch( ItemName )
{
case "Show All &Options":
m_ShowFullMenus = !m_ShowFullMenus;
break;
case "&Packages":
break;
case "Packages and &Elements":
break;
}
}
public void EA_Disconnect()
{
GC.Collect();
GC.WaitForPendingFinalizers();
}
}
}