protected override async void OnAppearing()
        {
            base.OnAppearing();

            var locator  = CrossGeolocator.Current;
            var position = await locator.GetPositionAsync();

            var venues = await VenueLogic.GetVenues(position.Latitude, position.Longitude);

            venueListView.ItemsSource = venues;
        }
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            // Get user's location
            VenueLogic venueLogic = new VenueLogic();
            var        location   = await CrossGeolocator.Current.GetPositionAsync();

            var venues = await venueLogic.GetVenues(location.Latitude, location.Longitude);

            ListViewVenue.ItemsSource = venues;
        }
Пример #3
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();


            var locator = CrossGeolocator.Current;
            // var position = await locator.GetPositionAsync();
            //var venues = await VenueLogic.GetVenues(position.Latitude, position.Longitude);
            var venues = await VenueLogic.GetVenues(-12.0741888, -77.03101439999999);

            venueListView.ItemsSource = venues;
        }
Пример #4
0
    private async void onAppearing(object sender, EventArgs args)
    {
        try {
            var locator  = CrossGeolocator.Current;
            var position = await locator.GetPositionAsync();

            var vanues = await VenueLogic.getVenues(position.Latitude, position.Longitude);

            venueListView.ItemsSource = vanues;
        } catch (Exception ex) {
            //handler error (Log?)
        }
    }
Пример #5
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            //gets the user current location from the Geolocator obj
            var locator  = CrossGeolocator.Current;
            var position = await locator.GetPositionAsync();

            //uses the venuelogic class to build a list from the json source script
            var venues = await VenueLogic.GetVenuesAsync(position.Latitude, position.Longitude);

            //sets the itemsource to display the data in the listview control
            venuelistview.ItemsSource = venues;
        }
Пример #6
0
        // override here - this called whenever page loaded by new user
        protected async override void OnAppearing()
        {
            base.OnAppearing();
            try
            {
                var status = await CrossPermissions.Current.CheckPermissionStatusAsync(Plugin.Permissions.Abstractions.Permission.Location);

                // Check whether (location) permission granted or not
                if (status != PermissionStatus.Granted)
                {
                    // If not yet granted by user, try asking for permission to use location
                    if (await CrossPermissions.Current.ShouldShowRequestPermissionRationaleAsync(Permission.Location))
                    {
                        await DisplayAlert("Need permission", "The app will need to access your location", "Ok");
                    }

                    var results = await CrossPermissions.Current.RequestPermissionsAsync(Permission.Location);

                    // Try again, to see whether permissions *now* granted
                    if (results.ContainsKey(Permission.Location))
                    {
                        status = results[Permission.Location];      // update in case permission was granted just now
                    }
                }
                if (status == PermissionStatus.Granted)
                {
                    try
                    {
                        var locator  = CrossGeolocator.Current;
                        var position = await locator.GetPositionAsync();

                        var venues = await VenueLogic.GetVenues(position.Latitude, position.Longitude);

                        venueListView.ItemsSource = venues;
                    }
                    catch (Exception exc)
                    {
                        await DisplayAlert("Problem/Error", exc.Message, "Ok");
                    }
                }
                else
                {
                    await DisplayAlert("No permission", "App cannot proceed and get nearby features because you did not grant permission to access your location", "Ok");
                }
            }
            catch (Exception ex)
            {
            }
        }
Пример #7
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            loading.IsVisible = true;
            loading.IsRunning = true;

            var locator  = CrossGeolocator.Current;
            var position = await locator.GetPositionAsync();

            var venues = await VenueLogic.Getvenues(position.Latitude, position.Longitude);

            venuelist.ItemsSource = venues;

            loading.IsRunning = false;
            loading.IsVisible = false;
        }