public SearchResultsViewController (SearchResultsPresenter presenter) : base ("SearchResultsViewController", null) { Title = "Results"; _presenter = presenter; }
private void SearchForProperties() { _view.IsLoading = true; _view.SetMessage(null); _searchItem.FindProperties(_propertyDataSource, 1, response => { if (response is PropertyListingsResult) { var propertiesResponse = (PropertyListingsResult)response; if (propertiesResponse.Data.Count == 0) { _view.SetMessage("There were no properties found for the given location."); } else { var listingsResponse = (PropertyListingsResult)response; _state.AddSearchToRecent(new RecentSearch(_searchItem, listingsResponse.TotalResult)); _view.DisplayRecentSearches(_state.RecentSearches); var presenter = new SearchResultsPresenter(_navigationService, _state, listingsResponse, _searchItem, _propertyDataSource); _navigationService.PushPresenter(presenter); } } else if (response is PropertyLocationsResult) { _view.DisplayRecentSearches(null); _view.DisplaySuggestedLocations(((PropertyLocationsResult)response).Data); } else { _view.SetMessage("The location given was not recognised."); } _view.IsLoading = false; }, error => { _view.SetMessage("An error occurred while searching. Please check your network connection and try again."); _view.IsLoading = false; }); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SupportActionBar.SetDisplayHomeAsUpEnabled(true); LayoutInflater li = (LayoutInflater)GetSystemService(Context.LayoutInflaterService); footer = li.Inflate(Resource.Layout.load_more_footer, null); resultDetails = (TextView) footer.FindViewById(Resource.Id.result_details); footer.Click += OnFooterClicked; ListView.AddFooterView(footer); ListAdapter = new SearchResultsAdapter(this, new List<Property>() {}); var app = PropertyCrossApplication.GetApplication(this); presenter = (SearchResultsPresenter) app.Presenter; presenter.SetView(this); app.CurrentActivity = this; }
private void SearchForProperties() { _view.IsLoading = true; _view.SetMessage(null); _searchItem.FindProperties(_propertyDataSource, 1, response => { if (response is PropertyListingsResult) { var propertiesResponse = (PropertyListingsResult)response; if (propertiesResponse.Data.Count == 0) { _view.SetMessage("There were no properties found for the given location."); } else { var listingsResponse = (PropertyListingsResult)response; _state.AddSearchToRecent(new RecentSearch(_searchItem, listingsResponse.TotalResult)); _view.DisplayRecentSearches(_state.RecentSearches); var presenter = new SearchResultsPresenter(_navigationService, _state, listingsResponse, _searchItem, _propertyDataSource); _navigationService.PushPresenter(presenter); } } else if (response is PropertyLocationsResult) { _view.DisplayRecentSearches(null); _view.DisplaySuggestedLocations(((PropertyLocationsResult)response).Data); } else { _view.SetMessage("The location given was not recognised."); } _view.IsLoading = false; }, error => { _view.SetMessage("An error occurred while searching. Please check your network connection and try again."); _view.IsLoading = false; }); }