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.1500 (2.0.0.1500)

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 (ESRI.ArcGISExplorer.ConnectionException 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 ESRI.ArcGISExplorer.ConnectionException
  System.Diagnostics.Debug.Print(ex.Message)
End Try

Exceptions

ExceptionCondition
ESRI.ArcGISExplorer..::.ConnectionExceptionConnection failed. Check the Message and InnerException properties of the ConnectionException for more information about the reasons for the failure.

See Also