Select to view content in your preferred language

ProjectClosing event

767
2
Jump to solution
01-24-2018 11:18 AM
PeteVitt
Occasional Contributor III

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

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Pete,

In your config.daml file for the VS project, find the module entry and set autoLoad to true.

<modules>
    <insertModule id="EventModule_Module" className="Module1" autoLoad="true" caption="Module1">

View solution in original post

2 Replies
by Anonymous User
Not applicable

Pete,

In your config.daml file for the VS project, find the module entry and set autoLoad to true.

<modules>
    <insertModule id="EventModule_Module" className="Module1" autoLoad="true" caption="Module1">
PeteVitt
Occasional Contributor III

Thanks Sean that did the trick!

0 Kudos