private async void Success(MvxGeoLocation location) { var address = string.Empty; try { var add = await _geoCoder.GetAddress(location.Coordinates.Latitude, location.Coordinates.Longitude); address = add.Aggregate(string.Empty, (current, s) => current + s); #if DEBUG address += DateTime.Now; #endif } catch (Exception e) { Debug.WriteLine(e.Message); } var message = new LocationMessage(this, location.Coordinates.Latitude, location.Coordinates.Longitude) { Accuracy = location.Coordinates.Accuracy, Address = address }; Debug.WriteLine($"LS: {message.Lat} {message.Lng}"); _messenger.Publish(message); }
public async Task <IEnumerable <string> > GetAddress(double lat, double lng) { var now = DateTime.Now; if (now > _lastTime + CacheLifetime) { _cachedResult = await _geoCoderService.GetAddress(lat, lng); _lastTime = now; } return(_cachedResult); }