Esempio n. 1
0
        public async Task RefreshDataAsync()
        {
            UpdateInProgress = true;

            if (ViewMode == SprudelDetailPageViewModeEnum.DisplayFavorite)
            {
                var repo     = CreateSprudelRepository();
                var newInfos = await repo.RefreshAsync();

                if (newInfos.Succeeded)
                {
                    QueryResult = newInfos.Results.Single(r => r.UniqueId == QueryResult.UniqueId);
                }
                else
                {
                    ErrorService.ShowLightDismissError("Refresh der Preise ist fehlgeschlagen");
                }
            }
            else
            {
                var gasinfoProxy = CreateGasPriceInfoProxy();
                var result       = await gasinfoProxy.DownloadAsync(QueryResult);

                if (result.Succeeded)
                {
                    QueryResult = result.Result;
                }
                else
                {
                    ErrorService.ShowLightDismissError("Refresh der Preise ist fehlgeschlagen");
                }
            }

            UpdateInProgress = false;
        }
Esempio n. 2
0
        public async Task DownloadInfoAsync(double lat1, double long1, double lat2, double long2)
        {
            var fueltype  = QueryResult.FuelType;
            var parameter = new GasQuery(Guid.NewGuid().ToString(), fueltype, long1, lat1, long2, lat2);

            try
            {
                var gasinfoProxy = CreateGasPriceInfoProxy();
                var result       = await gasinfoProxy.DownloadAsync(parameter);

                if (result.Succeeded)
                {
                    SetQueryResultToGeocodeResult(result.Result);
                    SendUpdateMapNotification();

                    CurrentLocationFound = true;
                }
                else
                {
                    ErrorService.ShowLightDismissError("Die Preisinformationen konnten nicht ermittelt werden");
                }
            }
            catch (Exception)
            {
                ErrorService.ShowLightDismissError("Die Preisinformationen konnten nicht ermittelt werden");
            }

            UpdateInProgress = false;
        }
Esempio n. 3
0
        private async Task LookupPositionAsync()
        {
            try
            {
                var currentGeoLocator = new Geolocator();
                var location          = await currentGeoLocator.GetGeopositionAsync();

                _positionChangeDetectionActive = true;
                var geocodedLocation = new Location(location.Coordinate.Latitude,
                                                    location.Coordinate.Longitude);
                myMap.SetView(geocodedLocation, 14.0f);

                ViewModel.GeocodeAsync(location.Coordinate.Latitude, location.Coordinate.Longitude);
                return;
            }
            catch (Exception)
            {
                // Potential cause: GetPositionAsync timeout
                ViewModel.UpdateInProgress = false;
            }

            ErrorService.ShowLightDismissError("Ihr Ort konnte nicht erfolgreich erkannt werden");
        }
Esempio n. 4
0
        public async Task RefreshDataAsync()
        {
            RefreshInProgress = true;

            var repo     = CreateSprudelRepository();
            var newInfos = await repo.RefreshAsync();

            RefreshInProgress = false;

            if (newInfos.Succeeded)
            {
                GasQueryResults.Clear();

                foreach (var current in newInfos.Results)
                {
                    GasQueryResults.Add(current);
                }
            }
            else
            {
                ErrorService.ShowLightDismissError("Refresh der Preise ist fehlgeschlagen");
            }
        }
Esempio n. 5
0
        public async Task GeocodeAsync(double latitude, double longitude)
        {
            // Provide interim information
            _geocodeResult = new GeocodeResult()
            {
                Latitude  = latitude,
                Longitude = longitude,
                Name      = String.Format("Lat: {0}, Lon: {1}", latitude, longitude)
            };
            SetQueryResultToGeocodeResult(QueryResult);

            try
            {
                var geocodeProxy = CreateGeocodeProxy();
                var result       = await geocodeProxy.ReverseGeocode(latitude, longitude);

                _geocodeResult = result;
                SetQueryResultToGeocodeResult(QueryResult);
            }
            catch (Exception)
            {
                ErrorService.ShowLightDismissError("Ihr Ort konnte nicht erfolgreich erkannt werden");
            }
        }