Message 1 of 4
C#.net Addin Event Handler Function

Not applicable
10-24-2009
12:34 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am writing an Addin for Inv2010, and I am trying to implement an event handler function for the "OnDocumentChange" application event. I can't figure out what is wrong with my code. I am using the Addin wizard as a base for my project, this code is in the StandardAddInServer.cs file.
I've simplified the code in my ApplicationEvents_OnDocumentChange handler function. I know the event is firing because I can capture it with the EventWatcher program supplied with the SDK. Debug shows that the program execution never enters my handler function. What am I doing wrong?
public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
{
. snip
.
}
void ApplicationEvents_OnDocumentChange(_Document DocumentObject, EventTimingEnum BeforeOrAfter, CommandTypesEnum ReasonsForChange, NameValueMap Context, out HandlingCodeEnum HandlingCode)
{
I am writing an Addin for Inv2010, and I am trying to implement an event handler function for the "OnDocumentChange" application event. I can't figure out what is wrong with my code. I am using the Addin wizard as a base for my project, this code is in the StandardAddInServer.cs file.
I've simplified the code in my ApplicationEvents_OnDocumentChange handler function. I know the event is firing because I can capture it with the EventWatcher program supplied with the SDK. Debug shows that the program execution never enters my handler function. What am I doing wrong?
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;
// Initialize event handlers
m_inventorApplication.ApplicationEvents.OnDocumentChange += new ApplicationEventsSink_OnDocumentChangeEventHandler(ApplicationEvents_OnDocumentChange);
. snip
.
}
void ApplicationEvents_OnDocumentChange(_Document DocumentObject, EventTimingEnum BeforeOrAfter, CommandTypesEnum ReasonsForChange, NameValueMap Context, out HandlingCodeEnum HandlingCode)
{
MessageBox.Show("Event Text");}
HandlingCode = HandlingCodeEnum.kEventHandled;