private void LoadTvEpisodes() { var xbmc = Xbmc.Xbmc.instance(); IncrementPending(); xbmc.GetRecentlyAddedEpisodes((rows) => { foreach (var row in rows) { int episodeId = (int)row["episodeid"]; var item = new TvEpisodeItem() { Id = episodeId, Title = (string)row["title"], Subtitle = (string)row["showtitle"], SortKey = (string)row["firstaired"], Play = new PlayCommand((e) => { xbmc.PlayEpisode(episodeId); }) }; item.SetThumbnail(xbmc.GetVfsUri((string)row["thumbnail"])); this.TvEpisodes.Add(item); if (Background == null) { SetBackground(xbmc.GetVfsUri((string)row["fanart"])); } } DecrementPending(); }); }
private void LoadSeason(Xbmc.Xbmc xbmc, TvSeasonItem season, JToken rows) { if (rows != null) { foreach (var row in rows) { var episodeId = (int)row["episodeid"]; var item = new TvEpisodeItem() { Id = episodeId, Title = (string)row["title"], Subtitle = (string)row["showtitle"], SortKey = (string)row["firstaired"], Play = new PlayCommand((e) => { xbmc.PlayEpisode(episodeId); }) }; item.SetThumbnail(xbmc.GetVfsUri((string)row["thumbnail"])); if (Background == null) { SetBackground(xbmc.GetVfsUri((string)row["fanart"])); } Debug.WriteLine(String.Format("S{0}E{1}", item.Season, item.Id)); season.Episodes.Add(item); } NotifyPropertyChanged("Seasons"); } }