public void GetSeasons(string showId, Action<IList<Season>, Exception> callback) { // Create the client WebClient client = new WebClient(); // Process the response from the server client.DownloadStringCompleted += (sender, e) => { if (e.Error != null) { callback(null, e.Error); return; } // A list to store the movies var result = new List<Season>(); // Parse the json response JObject o = JObject.Parse(e.Result); foreach (int jtShow in o["data"]) { // Create the movies var showSeason = new Season(); showSeason.Number = jtShow.ToString(); result.Add(showSeason); } callback(result, null); }; // Make the call to the server client.DownloadStringAsync(App.Current.Sick.GetSeasonList(showId)); }
public void GetSeasons(string seasonId, Action<IList<Season>, Exception> callback) { // Use this to create design time data var result = new List<Season>(); // Create 15 new movies for (var index = 0; index < 15; index++) { var season = new Season { Number = (index + 1).ToString() //Name = ("Name" + index).ToUpper(), //Plot = "Plot" + index, //NextAir = "2012-02-13", //Art = "http://nas.blackjid.info:8081/api/f5d6701f555447546b6030432d15e229/show.getposter/75760" //Backdrop = couch.FileCache("/volume1/downloads/dev/CouchPotatoServer/_data/cache/761d3c67b737bba21fae2acc6040bde5.jpg") }; result.Add(season); } callback(result, null); }