How to set a specific extent at startup

525
1
01-18-2012 10:41 PM
HassanMokdad
New Contributor
Hi,

I have an application that is composed from a dock window and an extension. At the onStartUp event of the Extension I am adding my own layers. The client requested that this Application should always open with a specified extent. I tried this code in the OnStartup event:
            ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.ZoomTo(new Envelope(27.0035540404876, 15.2397874917475, 56.8697829519645, 31.6822644786311), 800000);
but id did nothing. If I place this code insite the dock window it works fine, but the problem is that I can't do this because I can't be sure that onStartup of the application the dock window will be open. Is there a way to do this?

Thanks
0 Kudos
1 Reply
EdanCain
New Contributor II
You could save a map to the extent that you want. When you reopen the map it will be set to this extent automatically for you. This works ok until you or someone saves the map again.
To overcome this you could use the Application Configuration Manager and point the configuration to your map and remove the ability to save.

Edan
0 Kudos