Hi,
I want to execute my addin code after opening project in arcpro. I've config file which stores project related data. Now whenever I open project I need to activate addin and execute code to retrieve config file, to avoid this behavior I would like to execute some code by default on opening project.
Any help would be appreciated,
-Prashant
Solved! Go to Solution.
Hi @PrashantKirpan ,
It sounds like once our addin is installed, we just want it to execute code in response to the ProjectOpened event. You can find an example of subscribing to this event to execute code when a project is opened in the BackStage_PropertyPage community sample.
Hope that helps!
Hi @PrashantKirpan ,
It sounds like once our addin is installed, we just want it to execute code in response to the ProjectOpened event. You can find an example of subscribing to this event to execute code when a project is opened in the BackStage_PropertyPage community sample.
Hope that helps!
Thank you JamesBrander, perfectly working for me.
-Prashant
It seems that you got your add-in to work, but I just wanted to point out that by default add-ins are 'Just-in-time' (JIT) loaded, meaning they are not loaded and running until you interact through the UI with your add-in. If you want your add-in to work from startup (i.e. in order to listen to a project open/close event) you have to change the JIT default behavior by turning the 'autoload' (in config.daml) to true. You can find more documentation here: ProConcepts Framework · Esri/arcgis-pro-sdk Wiki (github.com)
If I have a proWindow in my add-in how can I cause that prowindow to initialize when the add-in is loaded? right now it only happens ona click of the button.
Usually you would not initialize a ProWindow before the class is instantiated, which happens when the ProWindow needs to open. I would recommend to move any initialization code into the Module class and make it accessible through an internal (or public) property in the Module class as in this example: Framework - ProWindowMVVM Community Sample