Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event can not be released #135

Open
Brent-bai opened this issue Sep 10, 2024 · 0 comments
Open

Event can not be released #135

Brent-bai opened this issue Sep 10, 2024 · 0 comments

Comments

@Brent-bai
Copy link

Brent-bai commented Sep 10, 2024

It's a addin application for solidworks, which contains a wpf window with the viewmodel .
In the viewmodel, I add two events by using the below code:

application.Documents.Active.Selections.NewSelection += Selections_NewSelection;
application.Documents.Active.Selections.ClearSelection += Selections_ClearSelection;

And another function which is getDoc method in the viewmodel, I use the linq statements to get the doc:

var doc = application.Documents.First(x => x.Title.Contains(name)); 

In the viewmodel.dispose() method, it will release the event:

application.Documents.Active.Selections.NewSelection -= Selections_NewSelection;
application.Documents.Active.Selections.ClearSelection -= Selections_ClearSelection;

The viewmodel.dispose() method would been called by wpf window_Closed method.
The issue is:
After I using the getDoc method, then closed the window, the events never been released. It always be called until I closed the solidworks application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant