ArcObjects Library Reference  

RestrictControl

About the StreetMap routing Sample

[C#]

RestrictControl.cs

using System;

namespace RoutingSample
{
	public partial class RestrictControl
	{

	#region Public properties
		// Restriction name
		public string RSName
		{
			get
			{
				return m_chkCheck.Text;
			}

			set
			{
				m_chkCheck.Text = value;
			}
		}

		// Is restriction checked
		public bool RSChecked
		{
			get
			{
				return m_chkCheck.Checked;
			}

			set
			{
				m_chkCheck.Checked = value;
			}
		}

		public enum ERSType: int
		{
			eStrict = 0,
			eRelaxed = 1
		}

		// Restriction Type
		public ERSType RSType
		{
			get
			{
        return (ERSType)m_cmbType.SelectedIndex;
			}

			set
			{
				m_cmbType.SelectedIndex = Convert.ToInt32(value);
			}
		}

		// Restriction Parameter
		public double RSParameter
		{
			get
			{
				if (! m_txtParameter.Enabled)
						return 0.0;

				double nVal = 0;
				try
				{
					nVal = double.Parse(m_txtParameter.Text);
				}
				catch (Exception ex)
				{
					nVal = 0;
				}

				return nVal;
			}

			set
			{
				m_txtParameter.Text = value.ToString();
			}
		}

		// Is Parameter enabled
		public bool RSUseParameter
		{
			set
			{
				if (! value)
						m_txtParameter.Text = "";
				m_txtParameter.Visible = value;
			}
		}

	#endregion

	}

} //end of root namespace
[Visual Basic .NET]

RestrictControl.vb

Public Class RestrictControl

#Region "Public properties"
	' Restriction name
	Public Property RSName() As String
		Get
			Return m_chkCheck.Text
		End Get

		Set(ByVal value As String)
			m_chkCheck.Text = value
		End Set
	End Property

	' Is restriction checked
	Public Property RSChecked() As Boolean
		Get
			Return m_chkCheck.Checked
		End Get

		Set(ByVal value As Boolean)
			m_chkCheck.Checked = value
		End Set
	End Property

	Public Enum ERSType
		eStrict = 0
		eRelaxed = 1
	End Enum

	' Restriction Type
	Public Property RSType() As ERSType
		Get
			Return m_cmbType.SelectedIndex
		End Get

		Set(ByVal value As ERSType)
			m_cmbType.SelectedIndex = value
		End Set
	End Property

	' Restriction Parameter
	Public Property RSParameter() As Double
		Get
			If Not m_txtParameter.Enabled Then _
				Return 0.0

			Dim nVal As Double
			Try
				nVal = Double.Parse(m_txtParameter.Text)
			Catch ex As Exception
				nVal = 0
			End Try

			Return nVal
		End Get

		Set(ByVal value As Double)
			m_txtParameter.Text = value.ToString
		End Set
	End Property

	' Is Parameter enabled
	Public WriteOnly Property RSUseParameter() As Boolean
		Set(ByVal value As Boolean)
			If Not value Then _
				m_txtParameter.Text = ""
			m_txtParameter.Visible = value
		End Set
	End Property

#End Region

End Class