Is there a Grasshopper window closed event?

Hi , I am running a timer inside a custom component and I want to stop it when user closes the grasshopper window. how can I catch the window closed event from the grasshopper custom component ?

Grasshopper.Instances.DocumentEditor.WindowState can be “Normal” or “Minimized”
also Grasshopper.Instances.DocumentEditor.Visible is a bool that tells you if the gh window was “closed” (with the “X” button)

2 Likes

it worked. thanks a lot