private void SendTrendingShowsToFacade(IEnumerable <TraktTrendingShow> shows) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (shows.Count() == 0) { GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoTrendingShows); GUIWindowManager.ShowPreviousWindow(); return; } // filter shows shows = GUICommon.FilterTrendingShows(shows); // sort shows var showList = shows.ToList(); showList.Sort(new GUIListItemShowSorter(TraktSettings.SortByTrendingShows.Field, TraktSettings.SortByTrendingShows.Direction)); int itemId = 0; List <TraktShow.ShowImages> showImages = new List <TraktShow.ShowImages>(); foreach (var show in showList) { GUITraktTrendingShowListItem item = new GUITraktTrendingShowListItem(show.Title); item.Label2 = show.Year.ToString(); item.TVTag = show; item.Item = show.Images; item.ItemId = Int32.MaxValue - itemId; item.IconImage = "defaultVideo.png"; item.IconImageBig = "defaultVideoBig.png"; item.ThumbnailImage = "defaultVideoBig.png"; item.OnItemSelected += OnShowSelected; Utils.SetDefaultIcons(item); Facade.Add(item); itemId++; // add image for download showImages.Add(show.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", shows.Count().ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", shows.Count().ToString(), shows.Count() > 1 ? Translation.SeriesPlural : Translation.Series)); GUIUtils.SetProperty("#Trakt.Trending.PeopleCount", shows.Sum(s => s.Watchers).ToString()); GUIUtils.SetProperty("#Trakt.Trending.Description", string.Format(Translation.TrendingTVShowsPeople, shows.Sum(s => s.Watchers).ToString(), shows.Count().ToString())); // Download show images Async and set to facade GetImages(showImages); }
private void SendTrendingShowsToFacade(IEnumerable<TraktTrendingShow> shows) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (shows.Count() == 0) { GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoTrendingShows); GUIWindowManager.ShowPreviousWindow(); return; } // filter shows shows = GUICommon.FilterTrendingShows(shows); // sort shows var showList = shows.ToList(); showList.Sort(new GUIListItemShowSorter(TraktSettings.SortByTrendingShows.Field, TraktSettings.SortByTrendingShows.Direction)); int itemId = 0; List<TraktShow.ShowImages> showImages = new List<TraktShow.ShowImages>(); foreach (var show in showList) { GUITraktTrendingShowListItem item = new GUITraktTrendingShowListItem(show.Title); item.Label2 = show.Year.ToString(); item.TVTag = show; item.Item = show.Images; item.ItemId = Int32.MaxValue - itemId; item.IconImage = "defaultVideo.png"; item.IconImageBig = "defaultVideoBig.png"; item.ThumbnailImage = "defaultVideoBig.png"; item.OnItemSelected += OnShowSelected; Utils.SetDefaultIcons(item); Facade.Add(item); itemId++; // add image for download showImages.Add(show.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", shows.Count().ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", shows.Count().ToString(), shows.Count() > 1 ? Translation.SeriesPlural : Translation.Series)); GUIUtils.SetProperty("#Trakt.Trending.PeopleCount", shows.Sum(s => s.Watchers).ToString()); GUIUtils.SetProperty("#Trakt.Trending.Description", string.Format(Translation.TrendingTVShowsPeople, shows.Sum(s => s.Watchers).ToString(), shows.Count().ToString())); // Download show images Async and set to facade GetImages(showImages); }