Initializes a new instance of the ServiceConnectionProperties class. This class constructor can be used to define the connection information to an ArcGIS Server 2D map service, or a WMS service.

Namespace:  ESRI.ArcGISExplorer.Data
Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.900 (2.0.0.900)

Syntax

C#
public ServiceConnectionProperties(
	ServiceType ServiceType,
	Uri url,
	string serviceName
)
Visual Basic (Declaration)
Public Sub New ( _
	ServiceType As ServiceType, _
	url As Uri, _
	serviceName As String _
)

Parameters

ServiceType
Type: ESRI.ArcGISExplorer.Data..::.ServiceType
One of the ServiceType values which defines the type of service.
url
Type: System..::.Uri
A Uri object which represents a Uniform Resource Identifier and consists of a string of characters used to identify the service on the Internet.
serviceName
Type: System..::.String
The name of the service.

Examples

The code below demonstrates how to define the connection information to an ArcGIS Server map service using a ServiceConnectionProperties object. A ServiceLayer object is also created, then connected to the service and added to the map as a layer.
CopyC#
{
  //Define the connection properties to the GeoEye_Imagery_World_2D Map service
  ServiceConnectionProperties connProps = new ServiceConnectionProperties(ServiceType.MapServer,
                                               new Uri("http://services.arcgisonline.com/arcgis/services"),
                                                "GeoEye_Imagery_World_2D");

  //Create a new ServiceLayer
  ServiceLayer serviceLayer = new ServiceLayer(connProps);

  //Try to connect the layer to the service
  bool connected = serviceLayer.Connect();

  //Check to see whether the connection was successful
  if (connected)
  {
    //Add the layer to the map.
    ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map.ChildItems.Add(serviceLayer);
  }
  else
  {
    //Investigate connection issue.
    ConnectionStatus status = serviceLayer.ConnectionStatus;
    if (status.HasError)
    {
      System.Diagnostics.Debug.Print(status.ErrorString);
    }
  }
}
CopyVB.NET
'Define the connection properties to the GeoEye_Imagery_World_2D Map service
Dim connProps As ServiceConnectionProperties = New ServiceConnectionProperties(ServiceType.MapServer, _
                                                   New Uri("http://services.arcgisonline.com/arcgis/services"), _
                                                  "GeoEye_Imagery_World_2D")

'Create a new ServiceLayer
Dim srviceLayer As ServiceLayer = New ServiceLayer(connProps)

'Try to connect the layer to the service
Dim connected As Boolean = srviceLayer.Connect()

'Check to see whether the connection was successful
If (connected) Then
  'Add the layer to the map.
  ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map.ChildItems.Add(srviceLayer)
Else
  'Investigate connection issue.
  Dim status As ConnectionStatus = srviceLayer.ConnectionStatus
  If (status.HasError) Then
    System.Diagnostics.Debug.Print(status.ErrorString)
  End If
End If

See Also

Relate Topics:
  ServiceConnectionProperties Constructor (BingMapsService)
  ServiceConnectionProperties Constructor (ServiceType, Uri)
  ServiceConnectionProperties Constructor (ServiceType, Uri, String, String)
Created by Atop CHM to web converter,© 2009 all right reserved.