예제 #1
0
        public async Task Refresh()
        {
            if (!IsBusy)
            {
                IsBusy = true;
            }

            Businesses.Clear();
            var businesses = await BusinessStore.GetItemsAsync();

            Businesses.AddRange(businesses);

            CurrentLocation = await Geolocation.GetLocationAsync();

            IsBusy = false;
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
 public static Task <Location?> GetLocationAsync(this IGeolocation geolocation, GeolocationRequest request) =>
 geolocation.GetLocationAsync(request ?? new GeolocationRequest(), default);