public async Task Refresh() { if (!IsBusy) { IsBusy = true; } Businesses.Clear(); var businesses = await BusinessStore.GetItemsAsync(); Businesses.AddRange(businesses); CurrentLocation = await Geolocation.GetLocationAsync(); IsBusy = false; }
public override async void OnNavigatedTo(INavigationParameters parameters) { try { Status = "Fetching location..."; var res = await _geolocation.GetLocationAsync(); if (res != null) { await _navigationService.NavigateAsync("MainPage"); } else { Status = "Unable to fetch location"; } } catch (System.Exception ex) { Status = "Unable to fetch location"; Debug.WriteLine(ex); } }
public static Task <Location?> GetLocationAsync(this IGeolocation geolocation, GeolocationRequest request) => geolocation.GetLocationAsync(request ?? new GeolocationRequest(), default);