Book Image

Windows Phone 7.5: Building Location-aware Applications

Book Image

Windows Phone 7.5: Building Location-aware Applications

Overview of this book

Windows Phone 7.5 has met with some great initial reviews from all mobile critics. It is poised to be the '3rd' eco-system for mobile, joining Apple's iOS and Google's Android platform. With Microsoft and Nokia working on multiple devices based on Windows Phone, the platform is a no-brainer enterprise success. Microsoft Office, Email, Skype and a fresh new mobile operating system has been a great champion of a cause for both Microsoft and Nokia. "Windows Phone 7.5: Building Location-aware Applications" will teach you to divein to the new Windows Phone Experience. No more 600 page bibles - just the right mix of text and lots of code to get you started!"Windows Phone 7.5: Building Location-aware Applications" covers location based services and maps, and focuses on methods of location detection and maps. Powered with this information, two real-world applications are covered. In short, this is a concise book on building location aware apps for Windows Phone.
Table of Contents (11 chapters)
Windows Phone 7.5: Building Location-aware Applications
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Using directions with Bing Maps directions task


We got acquainted with Launchers in our previous topic. Let us now look at BingMapsDirectionsTask, and use it to provide driving directions from within our application:

  1. 1. Create a copy of our HelloMaps-Pushpin project and rename it HelloMaps-Directions.

  2. 2. Open your MainPage.xaml.cs file and import the Microsoft.Phone.Tasks namespace into your project.

    using Microsoft.Phone.Tasks;
    
  3. 3. Assuming the maps center as Redmond, we want to show driving directions to the nearby Mercer Island as depicted in the following screenshot:

  4. 4. We begin by defining a variable myDrivingDirection of type BingMapsDirectionsTask as:

    BingMapsDirectionsTask myDrivingDirection;
    
  5. 5. In our MainPage() constructor, we define the start and end points of our route. The start being some location near Redmond and end being Mercer Island.

    // Show driving directions to Mercer Island
    // Use "null" as the starting location to use your current
    // location as the starting point.
    myDrivingDirection...