ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Core.Events Namespace / ProjectOpenedEvent Class / Subscribe Method
The delegate that is subscribed to the event ProjectEventArgs
(optional) True indicates the delegate has a strong reference to the event, and must be unsubscribed when the subscription is no longer needed. False indicates a weak delegate reference to the event. (default value = false)
Example

In This Topic
    Subscribe Method (ProjectOpenedEvent)
    In This Topic
    Subscribe to the ProjectOpenedEvent
    Syntax

    Parameters

    action
    The delegate that is subscribed to the event ProjectEventArgs
    keepSubscriberAlive
    (optional) True indicates the delegate has a strong reference to the event, and must be unsubscribed when the subscription is no longer needed. False indicates a weak delegate reference to the event. (default value = false)

    Return Value

    Example
    How to determine when a project is opened
    {
      // override the Initialize and Uninitialize methods of your add-in's module to subscribe and unsubscribe to the ProjectOpenedEvent
    
      ProjectOpenedEvent.Subscribe(OnProjectOpened); //subscribe to Project opened event
    
      ProjectOpenedEvent.Unsubscribe(OnProjectOpened); //unsubscribe from the event as the module is unloaded
    
      void OnProjectOpened(ProjectEventArgs obj) //Project Opened event handler
      {
        MessageBox.Show($"{Project.Current} has opened"); //show your message box
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also