AnsweredAssumed Answered

ProjectClosing event

Question asked by pvitt on Jan 24, 2018
Latest reply on Jan 24, 2018 by pvitt

Hi - I want to listen to the project closing event, but am wondering where to put the code.  Now I have the code in the initialize event of my addin module, but it only runs if the user clicks to open the addin.  Is there some global space where the code will always run, even if the user doesnt click my module?  The code is below, and works fine when the module is clicked:

 

//module code

protected override bool Initialize()
{

//Closing event
ArcGIS.Desktop.Core.Events.ProjectClosingEvent.Subscribe((args) =>
{
MessageBox.Show("ProjectClosingEvent");
return Task.FromResult(0);
});
return true;
}

 

Thanks

 

Pete

Outcomes