Hey,
I'm new to C# and I'm currently in the process of changing my VBA programs over to C#. I've successfully created a button on a command bar and now want to link a command to said button. I just can't seem to get it to work. Below is my activate method in StandardAddInServer.cs. What do I have to add to this method or to StandardAddInServer.cs to get a command within the project to execute when the button is pressed.
public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
{
// This method is called by Inventor when it loads the addin.
// The AddInSiteObject provides access to the Inventor Application object.
// The FirstTime flag indicates if the addin is loaded for the first time.
// Initialize AddIn members.
m_inventorApplication = addInSiteObject.Application;
m_inventorApplication.Caption = "Addin Loaded";
m_ClientID = "61b5b9f4-3e8e-4d83-b856-52ef7b06238a";
ControlDefinitions controlDef = m_inventorApplication.CommandManager.ControlDefinitions;
oButton = controlDef.AddButtonDefinition("Mark Number", "MarkNumber", CommandTypesEnum.kQueryOnlyCmdType, m_ClientID,"Generate Mark #", "Mark #");
if (firstTime==true){
CommandBars comBars = m_inventorApplication.UserInterfaceManager.CommandBars;
CommandBar comBar = comBars.Add("IBG Add-Ins", "IBGADDINS", CommandBarTypeEnum.kRegularCommandBar, m_ClientID);
comBar.Visible = true;
comBar.Controls.AddButton(oButton);
oButton.Execute();
}
// TODO: Add ApplicationAddInServer.Activate implementation.
// e.g. event initialization, command creation etc.
}
Any help will be greatly appreciated. Thank you.