Skip to content

Instantly share code, notes, and snippets.

@jseger
Last active August 5, 2022 12:34
Show Gist options
  • Save jseger/1dc6f22fb97cbf96c0d1c22275e58daa to your computer and use it in GitHub Desktop.
Save jseger/1dc6f22fb97cbf96c0d1c22275e58daa to your computer and use it in GitHub Desktop.
internal class Module1 : Module
{
private static Module1 _this = null;
/// <summary>
/// Retrieve the singleton instance to this module here
/// </summary>
public static Module1 Current => _this ??= (Module1)FrameworkApplication.FindModule("Addin_Module");
#region Overrides
/// <summary>
/// Called by Framework when ArcGIS Pro is closing
/// </summary>
/// <returns>False to prevent Pro from closing, otherwise True</returns>
protected override bool CanUnload()
{
//TODO - add your business logic
//return false to ~cancel~ Application close
return true;
}
/// <summary>
/// Called by the Framework either explicitly with FrameworkApplication.FindModule or implicitly whenever any of their DAML elements (Panes, DockPanes, Controls, etc) are loaded.
/// </summary>
/// <returns>True if initialization was successful. False if it failed.</returns>
protected override bool Initialize()
{
// subscribe to application events
EditCompletedEvent.Subscribe(async (x) => {
Task.Factory.StartNew(() => {
var window = new MyProWindow1();
window.ShowDialog();
},
CancellationToken.None,
TaskCreationOptions.None,
QueuedTask.UIScheduler);
});
return base.Initialize();
}
#endregion Overrides
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment