Reply
Solved! Go to solution

Events Firing c# AddIn ST8

Hi everyone,

 

We have updated solidEdge from st3 to st8. Now our Addin (developed in c#) has some problems with firing some events.

 

Here is the code:

 

SolidEdgeFramework.Application Application _application;

 

private void subscribeSolidEdgeEvents()
{
ISEApplicationEvents_Event seAppEvents = (ISEApplicationEvents_Event)_application.ApplicationEvents;
seAppEvents.AfterActiveDocumentChange += this.AfterActiveDocumentChange;
seAppEvents.AfterDocumentOpen += this.AfterDocumentOpen;
}

 

private void AfterActiveDocumentChange(object doc)
{
// do something
}

 

private void AfterDocumentOpen(object theDocument)
{
// do something
}

 

I have also updated Interop.SolidEdge nuget to the latest version (108.8.0), but both events (AfterActiveDocumentChange and AfterDocumentOpen)
not firing anymore. Can You help me please?

 

Thanks in advance.

2 REPLIES
Solution
Solution
Accepted by topic author Enrico87
‎07-22-2016 06:21 AM

Re: Events Firing c# AddIn ST8

Your ISEApplicationEvents_Event seAppEvents are getting disposed because they are a local variable to the subscribeSolidEdgeEvents() method. Your code no longer works in new versions of SE because the devs changed the way they handle garbage collection (they own the process and default app domain so they can do that).

 

The correct approach is to make ISEApplicationEvents_Event seAppEvents a class variable. That way it will live throughout the lifetime of the class.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Events Firing c# AddIn ST8

Thank you so much. Now it's work!