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
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:
IExtension ext = m_naEnv as IExtension;
object obj = axToolbarControl3.Object;
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;
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.