- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an addin that does some additional processing on save of a drawing. The whole thing is working great in my development environment. On a client machine, my onSave code is not being run. I tried installing Visual Studio on the client and the only time I can hit my onSave code is if I set a breakpoint on the line in Activate where the event is registered. I have a log entry right after the registration, so I can see that the code is getting there, but can't figure out why the registration doesn't happen without a breakpoint.
Here is the event registration:
public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime)
{
_inventorApp = addInSiteObject.Application;
Buttons.invButton.InventorApplication = _inventorApp;
_inventorApp.ApplicationEvents.OnSaveDocument += new ApplicationEventsSink_OnSaveDocumentEventHandler(onSaveEvent); //I need a breakpoint here in order to get to the event code
GenUtils.Logger.WriteLine("OnSave Event handler registered");
ControlDefinitions ctrlDefs = _inventorApp.CommandManager.ControlDefinitions;
etc....
Here is my event handler:
private void onSaveEvent(_Document DocumentObject, EventTimingEnum BeforeOrAfter, NameValueMap Context, out HandlingCodeEnum HandlingCode)
{
GenUtils.Logger.WriteLine("OnSave Event handler triggered");
if (BeforeOrAfter == EventTimingEnum.kAfter)
{
Document doc = Addin._inventorApp.ActiveDocument;
if (doc.DocumentType == DocumentTypeEnum.kDrawingDocumentObject)
InventorHelper.DoXML();
}
HandlingCode = HandlingCodeEnum.kEventNotHandled;
}
Any ideas?
Solved! Go to Solution.