Engine Network Analyst Window Command disabled

3348
2
11-25-2014 02:21 AM
croemersabris
New Contributor II

Hi,

i'm not shure if my question is here at the right place, i delelope with VS 2013, ArcObjects .NET an ArcGIS Engine Application, current Version 10.2.1.

I have an problem with the network analyst extension.

After a route is added the commands on the network analyst toolbar are not enabled (show network analyst window command and later the solve commands). I compared our Coding with the ExampleCode unter ArcObjects Help for .NET  (ArcGIS Network Analyst extension Engine application

http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#//0001000000pw000000)

I couldn‘t find the point which variable has to be set, that the NetworkAnalyst Toolbar activates the Commands The Code of the Toolbar is hidden, so I just know that there have to be some Events to which the ToolbarControl responds to activate the Command for the NetworkAnalystWindow and later when Locations are added to activate the other Commands/Tools (ex. Calculate). So my question is, which variables have to be set, that these Tools get activated?

in the example code are the Commands enabled in my code not.

Our code is differnent to the example code, that our application has beside the mapcontrol an pagelayoutcontrol.

This is a fragment of my code:

frmMain_Load:

axToolbarControl3.SetBuddyControl(axMapControl1); 

IExtension ext = m_naEnv as IExtension;

object obj = axToolbarControl3.Object;

ext.Startup(ref obj);

m_naWindow = m_naEnv.NAWindow;

m_onContextMenu = new IEngineNAWindowEventsEx_OnContextMenuEventHandler(OnContextMenu); ((IEngineNAWindowEventsEx_Event)m_naWindow).OnContextMenu += m_onContextMenu;

m_OnNetworkLayersChanged = new IEngineNetworkAnalystEnvironmentEvents_OnNetworkLayersChangedEventHandler(OnNetworkLayersChanged); ((IEngineNetworkAnalystEnvironmentEvents_Event)m_naEnv).OnNetworkLayersChanged += m_OnNetworkLayersChanged; m_OnCurrentNetworkLayerChanged = new IEngineNetworkAnalystEnvironmentEvents_OnCurrentNetworkLayerChangedEventHandler(OnCurrentNetworkLayerChanged); ((IEngineNetworkAnalystEnvironmentEvents_Event)m_naEnv).OnCurrentNetworkLayerChanged += m_OnCurrentNetworkLayerChanged;

Regards

Christoph Römer

0 Kudos
2 Replies
croemersabris
New Contributor II

Hi, i just want to remind, if there is someone who in familiar with programming ArcGIS Engine .Net applications using network analyst?

Regards Christoph Römer

0 Kudos
croemersabris
New Contributor II

I solved the problem, after commenting out line by line in the example code i figured out, that the axmapcontrol is the reason fpr the toolbar to get enabled. but i couldnt find a difference between the mapcontrol in my code and the example, so i just deleteted the mapcontrol in my Form and copied the one from the example into my Form and everything was fine.

I added the mapcontrol some years ago to the Form under ArcGIS 9.x and i just had to change some code when i migrated the application to higher ArcGIS Engine Versions. Even if the code didn't change there seem to be differences in private between the mapcontrol objects between 9.x nad 10.x which are elementary for the Network Analyst Tools.

0 Kudos