Over a million developers have joined DZone.

Windows Phone 8 Guide - Maps Tasks Launcher in Windows Phone

· Java Zone

Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code! Brought to you in partnership with ZeroTurnaround.

There are 4 different maps-related launchers available for developers for integrating the maps functionality in their Windows Phone App. These launchers are defined in the Microsoft.Phone.Tasks namepace. These include:

  • MapsTask
  • MapsDirectionTask
  • MapDownloaderTask
  • MapUpdaterTask

MapsTask

If you are looking out to open a map from your Windows Phone App and find out something that is nearby to you, you can use the MapsTask and specify the SearchTerm and the ZoomLevel.

These are 3 properties that are available in MapsTask class, these include:

  • Center - to set the location that will be used as the center for the map
  • SearchTerm - This property is used to search and tag locations on to the map
  • ZoomLevel - This is the initial zoom level of the map

Below is a code snippet demonstrating the usage of the MapsTask:

MapsTask btnGKmap1 = new MapsTask();

btnGKmap1.ZoomLevel = 11;

btnGKmap1.SearchTerm = locationToFind.Text;

btnGKmap1.Show()

MapsDirectionTask

Want to find out the direction from a location to another? MapsDirectionsTask is one of the options to do it. The MapsDirectionTask has the properties Start and End which can be used to specify the geographical location. The Start and End are of type LabeledMapLocation class.

Below is a sample code snippet demonstrating the MapsDirectionsTask:

MapsDirectionsTask direction = new MapDirectionsTask();

direction.End = new LabeledMapLocation(“End”, new GeoCoordinate(13.0022, 077.5980));

direction.Show();

MapDownloaderTask

Want to download a map for offline usage? The MapDownloaderTask lets the users download the necessary map to their device. Below is a code snippet demonstrating the usage of the MapDownloaderTask:

private void BtndownloadMaps(object sender, RoutedEventArgs e)

{

    MapDownloaderTask DownloadTask = new MapDownloaderTask();

    DownloadTask.Show();

}

MapUpdaterTask

Want to update a map that was already downloaded? Use the MapUpdaterTask. Below is a code snippet demonstrating how to use MapUpdaterTask:

private void btnUpdateMap(object sender, RoutedEventArgs e)

{

    MapUpdaterTask UpdateTask = new MapUpdaterTask();

    UpdateTask.Show();

}

The Java Zone is brought to you in partnership with ZeroTurnaround. Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code!

Topics:

Published at DZone with permission of Senthil Kumar, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}