Book Image

Windows Phone 7 Silverlight Cookbook

By : Jonathan Marbutt, Robb Schiefer
Book Image

Windows Phone 7 Silverlight Cookbook

By: Jonathan Marbutt, Robb Schiefer

Overview of this book

Silverlight has revolutionized development using Microsoft technologies. It is an excellent tool for mobile application development. The XAML-based markup and familiar C# code are the perfect combination for building apps efficiently and with minimum hassle.Packed full of recipes containing comprehensive instructions for the tasks required to build modern compelling smartphone apps using Silverlight.Starting with application design and architecture, you will quickly move on to more technical features and APIs you can implement to make your app stand out. You will use the Camera API to scan barcode, location services to pinpoint the user’s GPS coordinates and accelerometer to provide feedback based on movement of the phone. All of these features can be provided in a slick user interface through the power of Silverlight. Animations, behaviors and XAML provide all you need and more.
Table of Contents (18 chapters)
Windows Phone 7 Silverlight Cookbook
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Tracking latitude and longitude


In this recipe, we will implement the most fundamental use of location services, tracking latitude and longitude. Our sample application will be a navigation helper which displays all the available location information. We will also review the different ways in which the phone gets its location information and their attributes.

Getting ready

We will be working in Visual Studio for this tutorial, so start by opening Studio and creating a new Windows Phone 7 application using the Windows Phone Application project template.

All the location/GPS-related methods and classes are found in the System.Device assembly, so add this reference next:

We will need some UI to start tracking and displaying the data, so go to the MainPage.xaml file, if it's not already open. Change the ContentPanel from a Grid to a StackPanel, then add a button to the designer, and set its Content property to Start Tracking. Next add four TextBlocks. Two of these will be Latitude and Longitude...