private void DoYelpSearch() { string searchStr = SearchField.Text; YelpAPI yelp = new YelpAPI (); string resultStr = yelp.Search (SearchField.Text, "Beverly Hills, CA"); YelpResults resultSet = resultStr.FromJson<YelpResults> (); dataSource.resultSet = resultSet; ResultTable.ReloadData (); }
public async Task<Venue> LoadVenue(string venueId) { Yelp.YelpAPI yelp = new Yelp.YelpAPI (); string resultStr = await yelp.GetBusinessAsync (venueId); Yelp.Business result = resultStr.FromJson<Yelp.Business> (); if (result != null) { var newVenue = new Venue (result); _venueList [newVenue.id] = newVenue; return newVenue; } else return null; }
private void DoYelpSearch() { string searchStr = SearchField.Text; YelpAPI yelp = new YelpAPI (); string resultStr = yelp.Search (SearchField.Text, "Beverly Hills, CA"); YelpResults resultSet = null; if (!String.IsNullOrEmpty (resultStr)) resultSet = resultStr.FromJson<YelpResults> (); else { resultSet = YelpResults.CreateSample (); } dataSource.resultSet = resultSet; ResultTable.ReloadData (); }
public async Task<Venue> LoadVenue(string venueId) { Yelp.YelpAPI yelp = new Yelp.YelpAPI (); Yelp.Business result = null; try { string resultStr = await yelp.GetBusinessAsync (venueId); result = resultStr.FromJson<Yelp.Business> (); } catch (Exception exp) { Console.WriteLine("error fetching yelp business: " + exp.Message); } if (result == null) { // create placeholder result = Yelp.Business.CreateSample (); } // return venue from result var newVenue = new Venue (result); _venueList [newVenue.id] = newVenue; return newVenue; }