private void GeoCoordinateWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e) { if (CurrentAddress == null) { CurrentGeoCoordinate = geoCoordinateWatcher.Position.Location; BingLocationProvider.ResolveLocation(geoCoordinateWatcher.Position.Location, (address, exception) => { if (Loading) { Loading = false; if (address != null) { CurrentAddress = address; UpdateCurrentLocation(); } } }); } else { Loading = false; } }
/// <summary> /// Creates a location provider depending on the provider's name /// </summary> /// <param name="providerName">Provider name</param> /// <param name="locationProviderKey">API Key</param> /// <param name="coordinatesFilePath">Full path to the location coordinates data</param> /// <returns></returns> public static ILocationProvider Create(string providerName, string locationProviderKey, string coordinatesFilePath) { ILocationProvider retour = null; switch (providerName.ToLowerInvariant()) { case "bing": retour = new BingLocationProvider(locationProviderKey, coordinatesFilePath); break; case "google": default: break; } return(retour); }