private void Geocode()
        {
            GeoLocation location = new GeoLocation {
                Latitude = Latitude, Longitude = Longitude
            };

            var countryResult = _geocodeService.FindCountry(location);

            var stateResult = _geocodeService.FindUsaState(location);
        }
예제 #2
0
        private void Geocode()
        {
            bool latSuccess = double.TryParse(Latitude, out double lat);
            bool lonSuccess = double.TryParse(Longitude, out double lon);

            if (latSuccess && lonSuccess)
            {
                GeoLocation location = new GeoLocation {
                    Latitude = lat, Longitude = lon
                };

                var countryResult = _geocodeService.FindCountry(location);
                var stateResult   = _geocodeService.FindUsaState(location);

                CountryResult = countryResult?.Name ?? "N/A";
                Currency      = countryResult?.CurrencySymbol ?? "N/A";
                StateResult   = stateResult?.Name ?? "N/A";
            }
        }