public MapPageViewModel()
        {
            LoadRouteCommand        = new Command(async() => await LoadRoute());
            GetPlaceDetailCommand   = new Command <GooglePlaceAutoCompletePrediction>(async(param) => await GetPlacesDetail(param));
            GetPlacesCommand        = new Command <string>(async(param) => await GetPlacesByName(param));
            GetUserLocationCommand  = new Command(async() => await GetActualUserLocation());
            GetLocationNameCommand  = new Command <Position>(async(param) => await GetLocationName(param));
            ChangePageStatusCommand = new Command <PageStatusEnum>((param) =>
            {
                PageStatusEnum = param;

                if (PageStatusEnum == PageStatusEnum.Default)
                {
                    CleanPolylineCommand.Execute(null);
                    GetUserLocationCommand.Execute(null);
                    DestinationLocation = string.Empty;
                }
                else if (PageStatusEnum == PageStatusEnum.Searching)
                {
                    Places = new ObservableCollection <GooglePlaceAutoCompletePrediction>(RecentPlaces);
                }
            });

            ChooseLocationCommand = new Command <Position>((param) =>
            {
                if (PageStatusEnum == PageStatusEnum.Searching)
                {
                    GetLocationNameCommand.Execute(param);
                }
            });

            FillRecentPlacesList();
            FillPriceOptions();
            GetUserLocationCommand.Execute(null);
        }
예제 #2
0
        public AboutViewModel()
        {
            Title                   = "Search your Location";
            LoadRouteCommand        = new Command(async() => await LoadRoute());
            GetPlaceDetailCommand   = new Command <AutoCompletePlaceForGoogleMap>(async(param) => await GetPlacesDetail(param));
            GetPlacesCommand        = new Command <string>(async(param) => await GetPlacesByName(param));
            GetUserLocationCommand  = new Command(async() => await GetActualUserLocation());
            GetLocationNameCommand  = new Command <Position>(async(param) => await GetLocationName(param));
            ChangePageStatusCommand = new Command <PageStatusEnum>((param) =>
            {
                PageStatusEnum = param;

                if (PageStatusEnum == PageStatusEnum.Default)
                {
                    CleanPolylineCommand.Execute(null);
                    GetUserLocationCommand.Execute(null);
                    DestinationLocation = string.Empty;
                }
                else if (PageStatusEnum == PageStatusEnum.Searching)
                {
                    Places = new ObservableCollection <AutoCompletePlaceForGoogleMap>(RecentPlaces);
                }
            });

            ChooseLocationCommand = new Command <Position>((param) =>
            {
                if (PageStatusEnum == PageStatusEnum.Searching)
                {
                    GetLocationNameCommand.Execute(param);
                }
            });

            GetUserLocationCommand.Execute(null);
        }