Select to view content in your preferred language

Using MVVM's to open project with existing Map Pane View?

1549
11
Jump to solution
04-05-2023 07:26 AM
KT81
by
New Contributor III

I'm using Visual Studio with ArcGIS Pro SDK my current version of ArcGIS Pro is  3.1.0, A co-worker has created a python scripted that took 77 mxd's and converted them to aprx files, each one has an existing map in the Catalog pane associated with the map, but when you open the aprx there is no map pane view opened.  I was looking in the configuration of the ArcGIS Pro SDK and it seems like there should be a method to have the MVVM look to see if there is a map associated with the project and open that map in a map pane view.  I have narrowed down the location to be the ViewModel for the sdk configuration is where I should add an ICommand Interface or maybe another piece of code that adds this function to the "browse to project" functionality of the configuration,  but I haven't been able to find the documentation on how that command is called into the model view.  I was hoping someone could give me a little direction on if I am indeed correct or if there is another function / method I should be considering.

 

so this article goes into what I am trying to do but the I am not trying to use an OnClick method but use the View Model in the configuration to always check the project for a Map and open it up on startup of the project.

https://community.esri.com/t5/arcgis-pro-sdk-questions/open-an-existing-map/td-p/791296

Tags (3)
0 Kudos
11 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Hi Kelby,

 I think i found the problem in the TimerTick state machine code.  The variable _mapViewLoaded was not properly cleared before subscribing to the 'ActiveMapViewChanged' event.   I attached the fixed code.  This code is also using the ArcGIS Pro event logger.  To start the Pro diagnostic monitor you can use the Ctrl+Alt+M key sequence to start it, or the /enablediagnostics command line switch (see ProGuide Command line switches for ArcGISPro.exe · Esri/arcgis-pro-sdk Wiki (github.com) )

Wolf_0-1682705096964.png

Make sure to filter by 'ProcessProjectFiles' when viewing the log.

Anyways this attached add-in's version's start machine should work as required.

0 Kudos
KT81
by
New Contributor III

Thanks Wolf adding that event worked and cleared the subscription to event for the map being loaded.