Exemple #1
0
        public SearchPresenter(BaseActivity activity, Bundle extras)
        {
            this.activity = activity;
            this.view     = new SearchView(activity, this);
            UserTripDataManager dataManager = new UserTripDataManager();

            searchIntent = new SearchIntent(extras);
            SearchAndDisplayResults(searchIntent);
        }
Exemple #2
0
        public async void SearchAndDisplayResults(SearchIntent searchIntent)
        {
            this.view.ShowBusy(true);

            try{
                searchResult = await searchIntent.Search();
            }catch (Exception e) {
                Console.WriteLine(e.Message);
                searchResult = null;
            }

            if (searchResult != null)
            {
                activity.sendGaEvent("ui_action", "search trips", "search results", searchResult.itineraries.Count);
            }
            else
            {
                activity.sendGaEvent("ui_action", "search trips", "search results", -1);
            }
            this.view.ShowSearchResult(searchResult);
            this.view.ShowBusy(false);
        }
Exemple #3
0
        private async void Search(string startLocation, string endLocation, DateTime date, bool isDeparture, Distance maxWalkDistance)
        {
            string city  = "";
            string state = "";

            try{
                IList <Address> addressesNearMyLocation = await new Geocoder(activity).GetFromLocationAsync(_currentLocation.Latitude, _currentLocation.Longitude, 1);
                Address         addressNearMyLocation   = addressesNearMyLocation.First();
                if (addressNearMyLocation != null)
                {
                    try{
                        city  = addressNearMyLocation.Locality;
                        state = addressNearMyLocation.AdminArea;
                    }catch {
                    }
                }
            }catch {
            }
            SearchIntent searchIntent = new SearchIntent(activity.ApplicationContext,
                                                         startLocation, endLocation, date, isDeparture, typeof(SearchActivity), maxWalkDistance, city, state);

            //activity.StartActivity (searchIntent.intent);
            activity.StartActivityForResult(searchIntent.intent, 1);
        }