C# Grasshopper Component Application Shutdown Hook/Event

Hopefully a very easy question, how do I hook into an application shutdown event inside a component’s code?

There are some tasks it needs to do before quitting a session, but only upon quitting.

Is there a

public override void OnBeginShutdown

like in Excel or

public Result OnShutdown(UIControlledApplication application) {
    application.ControlledApplication.DocumentOpened -= OnDocOpened;
    //Rest of your code here...
    return Result.Succeeded;
}

like in Revit?

Thank you,

https://apidocs.co/apps/rhinocommon/7.3.21039.11200/E_Rhino_RhinoApp_Closing.htm

2 Likes

Thanks, will try it out.