private Location GetLocationFromGeocodeResponse(GoogleGeocodeResponse response) { var location = new Location(); if(response != null && response.Results != null && response.Results.Count > 0) { var firstResult = response.Results.First(); if(firstResult != null && firstResult.Geometry != null) { location = firstResult.Geometry.Location; } } return location; }
private string GetFormattedAddressFromGeocodeResponse(GoogleGeocodeResponse response) { string address = "[unknown address]"; if (response != null && response.Results != null && response.Results.Count > 0) { var firstResult = response.Results.First(); if (firstResult != null && firstResult.FormattedAddress != null) { address = firstResult.FormattedAddress; } } return address; }