O'Reilly logo

Windows® Phone 8 Unleashed by Daniel Vaughan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Location Tracking

In Chapter 17 you saw how a Geolocator provides geographic location updates. In this section you see how the custom IGeoLocator (presented in that chapter) can be used to track the location of the phone using a Map control.

The MapViewModel class’s StartTracking method instantiates either a GeolocatorProxy or a MockGeoLocator, depending on whether the class is executing within the emulator (see Listing 18.2).

When the GeoLocatorSampler object’s PropertyChanged event is raised, the Location, Center, and PositionStatus properties are updated. Changing the Center property changes the visible center point of the Map control and pans the map to the new GeoCoordinate.

An AppBarToggleButton in the view is data-bound to the viewmodel’s ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required