public async Task GetPlacesDetail(GooglePlaceAutoCompletePrediction placeA)
        {
            var place = await googleMapsApi.GetPlaceDetails(placeA.PlaceId);

            if (place != null)
            {
                if (isPickupFocused)
                {
                    PickupText      = place.Name;
                    latitude        = $"{place.Latitude}";
                    longitude       = $"{place.Longitude}";
                    isPickupFocused = false;
                    FocusOriginCommand.Execute(null);
                }
                else
                {
                    destinationLatitude  = $"{place.Latitude}";
                    destiantionLongitude = $"{place.Longitude}";

                    RecentPlaces.Add(placeA);
                    CleanFields();

                    searchedPlace = true;
                    await GetActualName();
                }
            }
        }
示例#2
0
        public async Task GetPlacesDetail(GooglePlaceAutoCompletePrediction placeA)
        {
            var place = await googleMapsApi.GetPlaceDetails(placeA.PlaceId);

            if (place != null)
            {
                if (_isPickupFocused)
                {
                    PickupText       = place.Name;
                    _originLatitud   = $"{place.Latitude}";
                    _originLongitud  = $"{place.Longitude}";
                    _isPickupFocused = false;
                    FocusOriginCommand.Execute(null);
                }
                else
                {
                    _destinationLatitud  = $"{place.Latitude}";
                    _destinationLongitud = $"{place.Longitude}";

                    RecentPlaces.Add(placeA);

                    if (_originLatitud == _destinationLatitud && _originLongitud == _destinationLongitud)
                    {
                        await App.Current.MainPage.DisplayAlert("Error", "Origin route should be different than destination route", "Ok");
                    }
                    else
                    {
                        LoadRouteCommand.Execute(null);
                        await App.Current.MainPage.Navigation.PopAsync(false);

                        CleanFields();
                    }
                }
            }
        }
示例#3
0
        public async Task GetPlacesDetail(GooglePlaceAutoCompletePrediction placeA)
        {
            var place = await googleMapsApi.GetPlaceDetails(placeA.PlaceId);



            if (place != null)
            {
                if (_isPickupFocused)
                {
                    PickupText       = place.Name;
                    _originLatitud   = $"{place.Latitude}";
                    _originLongitud  = $"{place.Longitude}";
                    _isPickupFocused = false;
                    FocusOriginCommand.Execute(null);
                }
                else
                {
                    _destinationLatitud  = $"{place.Latitude}";
                    _destinationLongitud = $"{place.Longitude}";

                    RecentPlaces.Add(placeA);

                    if (_originLatitud == _destinationLatitud && _originLongitud == _destinationLongitud)
                    {
                        await Application.Current.MainPage.DisplayAlert("Error", "Origin route should be different than Destination route", "Ok");
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(_originLatitud) || string.IsNullOrEmpty(_originLongitud))
                        {
                            await Application.Current.MainPage.DisplayAlert("Error", "Enter and select Origin from the list", "Ok");
                        }

                        else
                        {
                            LoadRouteCommand.Execute(null);

                            var masterDetailPage = Application.Current.MainPage as MasterDetailPage;



                            await masterDetailPage.Detail.Navigation.PopAsync();


                            CleanFields();
                        }
                    }
                }
            }
        }
示例#4
0
        public async Task GetPlacesDetail(GooglePlaceAutoCompletePrediction placeA)
        {
            var place = await googleMapsApi.GetPlaceDetails(placeA.PlaceId);

            if (place != null)
            {
                if (_isPickupFocused)
                {
                    PickupText       = place.Name;
                    _originLatitud   = $"{place.Latitude}";
                    _originLongitud  = $"{place.Longitude}";
                    _isPickupFocused = false;
                    FocusOriginCommand.Execute(null);
                }
                else
                {
                    _destinationLatitud  = $"{place.Latitude}";
                    _destinationLongitud = $"{place.Longitude}";

                    RecentPlaces.Add(placeA);

                    if (_originLatitud == _destinationLatitud && _originLongitud == _destinationLongitud)
                    {
                        var search = new MapView();
                        await App.Current.MainPage.DisplayAlert("", "Please Click the Search Button", "Ok");
                    }
                    else
                    {
                        LoadRouteCommand.Execute(null);
                        await App.Current.MainPage.Navigation.PopModalAsync(false);

                        CleanFields();
                    }
                }
            }
        }