Initializes a new ServiceLayer object and connects the layer to a Bing maps service.

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

Syntax

C#
public static ServiceLayer OpenBingMaps(
	BingMapsService bingMapsService
)
Visual Basic (Declaration)
Public Shared Function OpenBingMaps ( _
	bingMapsService As BingMapsService _
) As ServiceLayer

Parameters

bingMapsService
Type: ESRI.ArcGISExplorer.Data..::.BingMapsService
A BingMapsService value that represents a Bing service: Road, Hybrid or Aerial.

Return Value

A ServiceLayer object connected to the specified Bing maps service.

Remarks

Use this method to both instantiate a ServiceLayer and connect the layer to a Bing maps service. In contrast to the Connect method, an exception will be thrown if the specified service cannot be accessed.

Examples

The code below demonstrates how to both create and connect a ServiceLayer in a single call using the static OpenBingMaps method.
CopyC#
{
  try
  {
    //Create and connect to the Bing Maps road service and add it to the map as a layer
    ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map.ChildItems.Add(ServiceLayer.OpenBingMaps(BingMapsService.Road));
  }
  catch (Exception ex)
  {
    System.Diagnostics.Debug.Print(ex.Message);
  }
}
CopyVB.NET
Try  
  'Create and connect to the Bing Maps road service and add it to the map as a layer
  ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map.ChildItems.Add(ServiceLayer.OpenBingMaps(BingMapsService.Road))
Catch ex As Exception
  System.Diagnostics.Debug.Print(ex.Message)
End Try

See Also

Relate Topics:
  Connect Method
  CreateFromXmlString Method
  Disconnect Method
  MoveTo Method
  OpenGlobeServer Method
  OpenIms Method
  OpenMapServer Method
  OpenWms Method
Created by Atop CHM to web converter,© 2009 all right reserved.