Exemple #1
0
        /// <summary>
        /// Fetches location name and geographic position if needed
        /// </summary>
        private async Task <Tuple <BasicGeoposition, ReadableLocationName> > FetchGeolocationDataFromServiceAsync(bool fetchActualLocation = false)
        {
            BasicGeoposition updatedLocation = ActualLocation;

            if (fetchActualLocation || updatedLocation.IsDefault())
            {
                var geoposition = await _geolocationService.GetActualPositionAsync().ConfigureAwait(false);

                updatedLocation = geoposition.Coordinate.Point.Position;
            }

            var geopoint             = new Geopoint(updatedLocation);
            var readableLocationName = await _geolocationService.FindBestMatchedLocationAtAsync(geopoint).ConfigureAwait(false);

            return(new Tuple <BasicGeoposition, ReadableLocationName>(updatedLocation, readableLocationName));
        }