コード例 #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
ファイル: Geolocation.shared.cs プロジェクト: sung-su/maui
 public static Task <Location?> GetLocationAsync(this IGeolocation geolocation, GeolocationRequest request) =>
 geolocation.GetLocationAsync(request ?? new GeolocationRequest(), default);