Hi all -
I'm currently still evaluating EA 4.10.739, and in particular, I am looking at developing an addin using C#.
First, are addins supported in the trial edition? If not that might explain my problem!
The following code represents my addin:
using System;
using System.Runtime.InteropServices;
using EA;
namespace Plugin
{
#region IPlugin
public interface IPlugin
{
void EA_Connect(EA.Repository repository);
void EA_FileOpen(EA.Repository repository);
object EA_GetMenuItems(EA.Repository repository, string menuLocation, string menuName);
void EA_GetMenuState(EA.Repository repository, string menuLocation, string menuName, string itemName, ref bool isEnabled, ref bool isChecked);
void EA_MenuClick(EA.Repository repository, string menuLocation, string menuName, string itemName);
void EA_ShowHelp(EA.Repository repository, string menuLocation, string menuName, string itemName);
void EA_Disconnect();
}
#endregion
[System.Runtime.InteropServices.GuidAttribute( "21BF2AFD-8A39-43b1-B941-47F6DAA8F1F1" ),
System.Runtime.InteropServices.ComVisibleAttribute( true ),
System.Runtime.InteropServices.ClassInterfaceAttribute( ClassInterfaceType.None ) ]
public class Plugin :
Plugin.IPlugin
{
public Plugin()
{ }
public void EA_Connect(EA.Repository repository)
{
}
public void EA_Disconnect()
{
GC.Collect();
GC.WaitForPendingFinalizers();
}
public void EA_FileOpen(EA.Repository repository)
{
}
public object EA_GetMenuItems(EA.Repository repository, string menuLocation, string menuName)
{
if ( menuLocation == "MainMenu" )
{
if ( menuName == String.Empty )
return "-My &Plugin";
else if ( menuName == "-My &Plugin" )
return new string[] { "Hello", "World" };
else
return String.Empty;
}
else
{
return String.Empty;
}
}
public void EA_GetMenuState(EA.Repository repository, string menuLocation, string menuName, string itemName, ref bool isEnabled, ref bool isChecked)
{
isEnabled = true;
}
public void EA_MenuClick(EA.Repository repository, string menuLocation, string menuName, string itemName)
{
}
public void EA_ShowHelp(EA.Repository repository, string menuLocation, string menuName, string itemName)
{
}
}
}
Everything registers OK, and EA appears to load the addin. However, nothing will appear under the AddIn menu item in EA. Also, if I place a breakpoint in each of the methods, only EA_Disconnect() will ever get called. This is why I am wondering if AddIn's are not supported in the trial edition.
If this is not the case, then can anyone sport any problems with my code?? Any help would be gratefully appreciated.
Many thanks
- Tim