Mapping

Create and show a Bing map which you can use to display locations

Reference the library

C#
using CI.WSANative.Mapping;

Create a map

You will need a Bing maps key when you are ready to publish, you can register for one here. For development you can just use an empty string

C#
WSANativeMap.CreateMap(new WSAMapSettings() { MapServiceToken = "", HorizontalPlacement = WSAHorizontalPlacement.Centre, VerticalPlacement = WSAVerticalPlacement.Centre, Centre = new WSAGeoPoint() { Latitude = 50, Longitude = 0 }, ZoomLevel = 6, Height = 700, Width = 700, InteractionMode = WSAMapInteractionMode.GestureAndControl });

Centre the map

Centre the map on the specified location and optionally change the zoom level

C#
WSANativeMap.CenterMap(new WSAGeoPoint() { Latitude = 60, Longitude = 10 }, 8);

Add an element to the map

Add a marker to the map with the specified text and optional image. The "MapElementTapped" event is raised if the user taps on it

C#
WSANativeMap.AddMapElement("Test", new WSAGeoPoint() { Latitude = 60, Longitude = 10 }, "OptionalImageUri");

Clear the map of elements

C#
WSANativeMap.ClearMap();

Destroy the map

C#
WSANativeMap.DestroyMap();

Launch the maps app

Launch the built in maps app. You can pass in a query which controls what the map will display, do not include "bingmaps:?" at the start. See the Micosoft docs here for available options

If you are only using this function you do not need to follow the setup steps described below

C#
WSANativeMap.LaunchMapsApp("cp=40.726966~-74.006076");

Events

Listen to these events for info about user interactions with the map

C#
WSANativeMap.MapTapped
C#
WSANativeMap.MapElementTapped