public static void GetTravelstageCollectionAsync(IQueryBuilder url, TravelstageCollectionDelegate callback) { try { if (url == null) throw new Exception("Cannot work with null-objects"); if (String.IsNullOrEmpty(url.Url)) throw new Exception("Url cannot be empty"); var client = new WebClient(); client.DownloadStringCompleted += (s, e) => { if (e.Error != null) throw e.Error; if (e.Result == null) return; var collection = Json.JsonHelper.Deserialize<IList<Travelstage>>(e.Result); callback(new ObservableCollection<Travelstage>(collection)); }; client.DownloadStringAsync(new Uri(url.Url)); } catch (Exception) { throw; } }
public static void GetDeparturesAsync(GetDeparturesQueryBuilder url, TravelstageCollectionDelegate callback) { GetTravelstageCollectionAsync(url, callback); }
public static void GetArrivalsAdvancedAsync(GetArrivalsAdvancedQueryBuilder url, TravelstageCollectionDelegate callback) { GetTravelstageCollectionAsync(url, callback); }