private static async Task<List<Movie>> UpdateLocalWithShow(JObject o) { //ShowsList = new List<TVShow>(); //Adapter.ClearList(); var tempMovie = new Movie(); var Movies = new List<Movie>(); for (var i = 0; i < o["results"].Count(); i++) { tempMovie = PopulateBasicMovieFromJToken(o["results"][i]); var result = Movies.FirstOrDefault(c => c.TMDBID.Equals(tempMovie.TMDBID)); if (result == null) { //TODO check if show exsists in list Movies.Add(tempMovie); } else { //UpdateSavedAndTrakkedStatus(result); //TODO need to fix //Adapter.UpdateSavedAndTrakkedStatus(TrakkedShowsTMDBIDs); } } return Movies; }
private static Movie PopulateBasicMovieFromJToken(JToken jToken) { Movie myShow = new Movie(); myShow.Name = jToken["title"] + ""; myShow.TMDBID = jToken["id"] + ""; myShow.PosterLink = jToken["poster_path"] + ""; myShow.Overview = jToken["overview"] + ""; myShow.Language = jToken["original_language"] + ""; myShow.ReleaseDate = jToken["release_date"].ToObject<DateTime>(); return myShow; }
public void AddMovie(Movie movie) { Movies.Add(movie); }
private Movie PopulateBasicMovieFromJToken(JToken jToken) { Movie myShow = new Movie(); myShow.Name = jToken["title"] + ""; //myShow.Network = jToken["networks"][0]["name"] + ""; //myShow.NumberOfSeasons = (int)jToken["number_of_seasons"]; myShow.TMDBID = jToken["id"] + ""; myShow.PosterLink = jToken["poster_path"] + ""; myShow.Overview = jToken["overview"] + ""; myShow.Language = jToken["original_language"] + ""; myShow.ReleaseDate = jToken["release_date"].ToObject<DateTime>(); //UpdateSavedAndTrakkedStatus(myShow); return myShow; }
private async Task UpdateLocalWithShow(JObject o) { //ShowsList = new List<TVShow>(); //Adapter.ClearList(); var tempMovie = new Movie(); for (var i = 0; i < o["results"].Count(); i++) { tempMovie = PopulateBasicMovieFromJToken(o["results"][i]); var result = Movies.FirstOrDefault(c => c.TMDBID.Equals(tempMovie.TMDBID)); if (result == null) { //TODO check if show exsists in list Movies.Add(tempMovie); //showsJToken.Add(o["results"][i]); Adapter.AddMovie(tempMovie); if (Adapter.Count != 0 && Adapter.Count <= 12) { Adapter.NotifyDataSetChanged(); await Task.Delay(10); //UpdateActivityTitle(); } } else { //UpdateSavedAndTrakkedStatus(result); //TODO need to fix //Adapter.UpdateSavedAndTrakkedStatus(TrakkedShowsTMDBIDs); } } Adapter.NotifyDataSetChanged(); }