private void getToAirportsInfoCompleted(IAsyncResult result) { var request = (HttpWebRequest)result.AsyncState; var response = (HttpWebResponse)request.EndGetResponse(result); using (var stream = response.GetResponseStream()) { var r = new StreamReader(stream); var resp = r.ReadToEnd(); JArray values = JsonConvert.DeserializeObject <JArray>(resp); this.toAirports = Airport.makeAirport(values); } foreach (KeyValuePair <string, Airport> fromAirPort in this.fromAirports) { foreach (KeyValuePair <string, Airport> toAirPort in this.toAirports) { this.getFlights(fromAirPort.Value, toAirPort.Value, this.startDate, this.endDate , this.adultsNum, this.childrenNum, this.infantsNum, this.direct, this.maxPrice, this.travelClass); } } while (this.flightsNum < this.fromAirports.Count() * this.toAirports.Count()) { } this.getAttractions(this.radius, this.attractionsString); var x = 0; }
private void getFromAirportsInfoCompleted(IAsyncResult result) { var request = (HttpWebRequest)result.AsyncState; var response = (HttpWebResponse)request.EndGetResponse(result); using (var stream = response.GetResponseStream()) { var r = new StreamReader(stream); var resp = r.ReadToEnd(); JArray values = JsonConvert.DeserializeObject <JArray>(resp); this.fromAirports = Airport.makeAirport(values); var x = 0; } this.getToAirportsInfo(this.toCity.location); }