private void HandleResponse(string jsonResponse, Action <PropertyDataSourceResult> callback) { JObject json = JObject.Parse(jsonResponse); string responseCode = (string)json["response"]["application_response_code"]; if (responseCode == "100" || /* one unambiguous location */ responseCode == "101" || /* best guess location */ responseCode == "110" /* large location, 1000 matches max */) { var result = new PropertyListingsResult(json); callback(result); } else if (responseCode == "200" || /* ambiguous location */ responseCode == "202" /* mis-spelled location */) { var result = new PropertyLocationsResult(json); callback(result); } else { /* * 201 - unkown location * 210 - coordinate error */ callback(new PropertyUnknownLocationResult()); }; }
private void HandleResponse(string jsonResponse, Action<PropertyDataSourceResult> callback) { JObject json = JObject.Parse(jsonResponse); string responseCode = (string)json["response"]["application_response_code"]; if (responseCode == "100" || /* one unambiguous location */ responseCode == "101" || /* best guess location */ responseCode == "110" /* large location, 1000 matches max */) { var result = new PropertyListingsResult(json); callback(result); } else if (responseCode == "200" || /* ambiguous location */ responseCode == "202" /* mis-spelled location */) { var result = new PropertyLocationsResult(json); callback(result); } else { /* 201 - unkown location 210 - coordinate error */ callback(new PropertyUnknownLocationResult()); }; }
public SearchResultsPresenter(INavigationService navigationService, PropertyFinderPersistentState state, PropertyListingsResult results, SearchItemBase searchItem, PropertyDataSource dataSource) { _state = state; _navigationService = navigationService; _searchItem = searchItem; _dataSource = dataSource; _properties = results.Data; _totalResult = results.TotalResult; _totalPages = results.TotalPages; }
public SearchResultsViewModel(INavigationService navigationService, PropertyFinderPersistentState state, PropertyListingsResult results, SearchItemBase searchItem, PropertyDataSource dataSource) { _state = state; _navigationService = navigationService; _searchItem = searchItem; _dataSource = dataSource; var propertyViewModels = results.Data.Select(p => new PropertyViewModel(this, state, p)).ToList(); _properties = new ObservableCollection<PropertyViewModel>(propertyViewModels); _totalResult = results.TotalResult; _totalPages = results.TotalPages; }