ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Desktop.Framework.Contracts Namespace / Module Class / Uninitialize Method
Example

In This Topic
    Uninitialize Method (Module)
    In This Topic
    When overridden in a derived class, gives the custom Module a chance to uninitialize itself.
    Syntax
    protected internal virtual void Uninitialize()
    Protected Friend Overridable Sub Uninitialize() 
    Example
    How to determine when a project is opened
    protected override bool Initialize() //Called when the Module is initialized.
    {
      ProjectOpenedEvent.Subscribe(OnProjectOpened); //subscribe to Project opened event
      return base.Initialize();
    }
    
    private void OnProjectOpened(ProjectEventArgs obj) //Project Opened event handler
    {
      MessageBox.Show($"{Project.Current} has opened"); //show your message box
    }
    
    protected override void Uninitialize() //unsubscribe to the project opened event
    {
      ProjectOpenedEvent.Unsubscribe(OnProjectOpened); //unsubscribe
      return;
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also