Handling ArcMap closing event in AddIn?

المشرف العام

Administrator
طاقم الإدارة
I'm trying to handle the closing event of ArcMap within an ESRI Addin Extension using C# and arcobjects. Furthermore I would like to handle 'a closing event', that is fired BEFORE ArcMap tries to stop a started edit session. As background: I want to create an extension that does the database handling automatically without asking the user if he wants to save the changes in the database when closing ArcMap (this should happen programmatically).

At first I tried to handle the ESRI.ArcGIS.ArcMapUI.IDocumentEvents.BeforeCloseDocument, but this event will be fired AFTER ArcMap tries to stop an active edit session. The situation is not different with the ESRI.ArcGIS.Editor.IEditEvents2_Event.BeforeStopEditing event. In both cases the user is asked if he wants to save the changes before one can handle the event. And at last I tried the ESRI.ArcGIS.Desktop.AddIns.Extension.OnShutdown event, but this is fired much more later after the user is asked for saving the changes in the geodatabase and saving the MXD. Now I am at my wit’s end.

Does anyone else has an idea or a workaround? Have I missed another event? Is it possible to ‘cast’ the ArcMap application window to System.Windows.Forms.Form to wire the FormClosing event?



أكثر...
 
أعلى