private void SendShowSeasonsToFacade(IEnumerable <TraktShowSeason> seasons) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (seasons == null || seasons.Count() == 0) { GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoSeasonsForShow); GUIWindowManager.ShowPreviousWindow(); return; } // sort ascending or descending order if (TraktSettings.SortSeasonsAscending) { seasons = seasons.OrderBy(s => s.Season); } int itemId = 0; List <TraktShowSeason.SeasonImages> seasonImages = new List <TraktShowSeason.SeasonImages>(); foreach (var season in seasons) { string itemLabel = season.Season == 0 ? Translation.Specials : string.Format("{0} {1}", Translation.Season, season.Season.ToString()); GUITraktSeasonListItem item = new GUITraktSeasonListItem(itemLabel); item.Label2 = string.Format("{0} {1}", season.EpisodeCount, Translation.Episodes); item.TVTag = season; item.Item = season.Images; item.ItemId = Int32.MaxValue - itemId; item.IconImage = "defaultVideo.png"; item.IconImageBig = "defaultVideoBig.png"; item.ThumbnailImage = "defaultVideoBig.png"; item.OnItemSelected += OnSeasonSelected; Utils.SetDefaultIcons(item); Facade.Add(item); itemId++; // add image for download seasonImages.Add(season.Images); } // Set Facade Layout Facade.SetCurrentLayout(Enum.GetName(typeof(Layout), CurrentLayout)); GUIControl.FocusControl(GetID, Facade.GetID); Facade.SelectIndex(PreviousSelectedIndex); // set facade properties GUIUtils.SetProperty("#itemcount", seasons.Count().ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", seasons.Count().ToString(), seasons.Count() > 1 ? Translation.Seasons : Translation.Season)); // Download show images Async and set to facade GetImages(seasonImages); }
private void SendShowSeasonsToFacade(IEnumerable<TraktShowSeason> seasons) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (seasons == null || seasons.Count() == 0) { GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoSeasonsForShow); GUIWindowManager.ShowPreviousWindow(); return; } int itemId = 0; List<TraktShowSeason.SeasonImages> seasonImages = new List<TraktShowSeason.SeasonImages>(); foreach (var season in seasons) { string itemLabel = season.Season == 0 ? Translation.Specials : string.Format("{0} {1}", Translation.Season, season.Season.ToString()); GUITraktSeasonListItem item = new GUITraktSeasonListItem(itemLabel); item.Label2 = string.Format("{0} {1}", season.EpisodeCount, Translation.Episodes); item.TVTag = season; item.Item = season.Images; item.ItemId = Int32.MaxValue - itemId; item.IconImage = "defaultVideo.png"; item.IconImageBig = "defaultVideoBig.png"; item.ThumbnailImage = "defaultVideoBig.png"; item.OnItemSelected += OnSeasonSelected; Utils.SetDefaultIcons(item); Facade.Add(item); itemId++; // add image for download seasonImages.Add(season.Images); } // Set Facade Layout Facade.SetCurrentLayout(Enum.GetName(typeof(Layout), CurrentLayout)); GUIControl.FocusControl(GetID, Facade.GetID); Facade.SelectIndex(PreviousSelectedIndex); // set facade properties GUIUtils.SetProperty("#itemcount", seasons.Count().ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", seasons.Count().ToString(), seasons.Count() > 1 ? Translation.Seasons : Translation.Season)); // Download show images Async and set to facade GetImages(seasonImages); }