Handling location updates
Our next step is to build the MapPageViewModel
; this view model will contain the IGeolocator
we just built. We will also be listening for location updates from the observable sequence and processing latitude and longitude values to gather address details.
Let's begin with the constructor:
public MapPageViewModel (INavigationService navigation, IGeolocator geolocator, Func<Action, ICommand> commandFactory, IGeocodingWebServiceController geocodingWebServiceController) : base (navigation) { _geolocator = geolocator; _geocodingWebServiceController = geocodingWebServiceController; _nearestAddressCommand = commandFactory(() => FindNearestSite()); _geolocationCommand = commandFactory(() => { if (_geolocationUpdating) { geolocator.Stop(); } else { ...