private void DoLocationSelected(Location location) { SearchText = location.DisplayName; SuggestedLocations.Clear(); _searchItem = new PlainTextSearchItem(location.Name, location.DisplayName); SearchForProperties(); }
private void SearchForProperties() { IsBusy = true; Message = string.Empty; _searchItem.FindProperties(_dataSource, 1, response => { if (response is PropertyListingsResult) { var propertiesResponse = (PropertyListingsResult)response; if (propertiesResponse.Data.Count == 0) { Message = "There were no properties found for the given location."; } else { var listingsResponse = (PropertyListingsResult)response; _state.AddSearchToRecent(new RecentSearch(_searchItem, listingsResponse.TotalResult)); LoadRecentSearches(); if (_searchItem is PlainTextSearchItem) { ShowViewModel <SearchResultsViewModel>(_searchItem as PlainTextSearchItem); } else { var item = _searchItem as GeoLocationSearchItem; ShowViewModel <SearchResultsViewModel>(item.Location); } //Need to navigate here //_view.DisplayRecentSearches(_state.RecentSearches); //var presenter = new SearchResultsPresenter(_navigationService, _state, listingsResponse, // _searchItem, _propertyDataSource); //_navigationService.PushPresenter(presenter); ShowSelectLocation = false; } } else if (response is PropertyLocationsResult) { var results = ((PropertyLocationsResult)response).Data; SuggestedLocations.Clear(); foreach (Location location in results) { SuggestedLocations.Add(location); } ShowSelectLocation = true; } else { Message = "The location given was not recognised."; } IsBusy = false; }, error => { Message = "An error occurred while searching. Please check your network connection and try again."; IsBusy = false; }); }