ArcObjects Library Reference  

cmdNAProperties

About the Network Analyst Engine application Sample

[C#]

cmdNAProperties.cs

using System.Windows.Forms;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.ADF.BaseClasses;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.NetworkAnalyst;
using ESRI.ArcGIS.Controls;


// This command brings up the property pages for the Network Analyst environment.

namespace NAEngine
{
	[Guid("7E98FE97-DA7A-4069-BC85-091D75B1AF65")]
	[ClassInterface(ClassInterfaceType.None)]
	[ProgId("NAEngine.NAProperties")]
	public sealed class cmdNAProperties : BaseCommand
	{
		private IMapControl3 m_mapControl;

		public cmdNAProperties()
		{
			base.m_caption = "Properties...";
		}

		public override void OnClick()
		{
			// Get the network analyst environment
			IEngineNetworkAnalystEnvironment naEnv = new EngineNetworkAnalystEnvironmentClass();

			// Show the Property Page form for Network Analyst
			frmNAProperties props = new frmNAProperties();
			props.ShowModal(naEnv);
		}

		public override void OnCreate(object hook)
		{
			m_mapControl = (IMapControl3)hook;
		}
	}
}

[Visual Basic .NET]

cmdNAProperties.vb

Imports Microsoft.VisualBasic
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports ESRI.ArcGIS.ADF.BaseClasses
Imports ESRI.ArcGIS.Carto
Imports ESRI.ArcGIS.NetworkAnalyst
Imports ESRI.ArcGIS.Controls


' This command brings up the property pages for the Network Analyst environment.

Namespace NAEngine
	<Guid("ABB23EAB-E099-43f4-9654-0DAA1E71EDE4"), ClassInterface(ClassInterfaceType.None), ProgId("NAEngine.NAProperties")> _
 Public NotInheritable Class NAProperties : Inherits BaseCommand
		Private m_mapControl As IMapControl3

		Public Sub New()
			MyBase.m_caption = "Properties..."
		End Sub

		Public Overloads Overrides Sub OnClick()
			' Get the network analyst environment
			Dim naEnv As IEngineNetworkAnalystEnvironment = New EngineNetworkAnalystEnvironmentClass()

			' Show the Property Page form for Network Analyst
			Dim props As frmNAProperties = New frmNAProperties()
			props.ShowModal(naEnv)
		End Sub

		Public Overloads Overrides Sub OnCreate(ByVal hook As Object)
			m_mapControl = CType(hook, IMapControl3)
		End Sub
	End Class
End Namespace