Esempio n. 1
0
        private async void Getcleaners(object sender, EventArgs e)
        {
            ScaleButton();
            if (CrossConnectivity.Current.IsConnected)
            {
                using (UserDialogs.Instance.Loading("Please Wait..", null, null, true, MaskType.Gradient))
                {
                    try
                    {
                        if (locationpicker.SelectedIndex == -1)
                        {
                            await DisplayAlert("Error..", "Please select your city", "ok");

                            return;
                        }

                        var loc  = locationpicker.Items[locationpicker.SelectedIndex];
                        var data = await service.GetCleaners(loc);

                        if (data.Count == 0)
                        {
                            await DisplayAlert("Oops!", "There are no cleaners in your area at the moment,Check back later", "ok");
                        }
                        else
                        {
                            CleanerList = data;
                            await DisplayAlert("Awesome", "we found " + data.Count.ToString() + " cleaners in your area ", "Proceed");

                            await Navigation.PushAsync(new CleanersPage(CleanerList, loc));
                        }
                    }
                    catch (Exception)
                    {
                        await DisplayAlert("Hello" + " " + Settings.UserName, "We trust you are doing fine", "Sure");
                    }
                }
            }
            else
            {
                await DisplayAlert("Connection Timeout", "Check your internet connection and try again", "ok");
            }
        }