コード例 #1
0
		private string BuildUrl (GeocodingRequest request)
		{
			var path = BaseUrl + "?language=en";
			if (!string.IsNullOrEmpty (apiKey))
			{
				path += "&key=" + apiKey;
			}
			return request.AddParametersToUrl (path);
		}
コード例 #2
0
        private string BuildUrl(GeocodingRequest request)
        {
            var path = BaseUrl + "?language=en";

            if (!string.IsNullOrEmpty(apiKey))
            {
                path += "&key=" + apiKey;
            }
            return(request.AddParametersToUrl(path));
        }
コード例 #3
0
		public async Task<GeocodingResult[]> GetAddressesAsync (GeocodingRequest request)
		{
			request.Validate ();

			var path = Uri.EscapeUriString (BuildUrl (request));

			var json = await httpClient.GetStringAsync (path);

			var response = JsonConvert.DeserializeObject<GeocodingResponse> (json);

			if (response.IsSuccess)
			{
				return response.Results;
			}

			throw new InvalidOperationException (string.Format ("Google Geocoding error [code: {0}]: {1}", response.Status, response.ErrorMessage));
		}
コード例 #4
0
        public async Task <GeocodingResult[]> GetAddressesAsync(GeocodingRequest request)
        {
            request.Validate();

            var path = Uri.EscapeUriString(BuildUrl(request));

            var json = await httpClient.GetStringAsync(path);

            var response = JsonConvert.DeserializeObject <GeocodingResponse> (json);

            if (response.IsSuccess)
            {
                return(response.Results);
            }

            throw new InvalidOperationException(string.Format("Google Geocoding error [code: {0}]: {1}", response.Status, response.ErrorMessage));
        }