I have a set of tools that I've built as a class library that is hosted/referenced within a main application (ESRI's ArcMap). I'd like to manage the case where a user may pull the pin on the main application while they have unsaved/unmanaged edits pending. I tried handling the Application.ThreadExit event w/ no success. Is there a best practice for accessing the closure of a hosting application in .Net? Is this even possible?
There is an event handler for the currently opened document in ArcMap. Have a look here:
You can listen to the BeforeCloseDocument_Event
and develop some logic to handle the case of a closing document (the document is closed when the application is closed).