TraktPlugin.GUI.GUIRecommendationsShows.SendRecommendedShowsToFacade C# (CSharp) Méthode

SendRecommendedShowsToFacade() private méthode

private SendRecommendedShowsToFacade ( IEnumerable shows ) : void
shows IEnumerable
Résultat void
        private void SendRecommendedShowsToFacade(IEnumerable<TraktShowSummary> shows)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

            if (shows == null)
            {
                GUIUtils.ShowNotifyDialog(Translation.Error, Translation.ErrorGeneral);
                GUIWindowManager.ShowPreviousWindow();
                return;
            }

            if (shows.Count() == 0)
            {
                // try again
                if (genreButton == null)
                {
                    // restore defaults for next time so we can get recommendations
                    if (CurrentGenre != "All")
                        CurrentGenre = "All";

                    _RecommendedShows = null;
                    GUIWindowManager.ShowPreviousWindow();
                }
                else
                {
                    GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoShowRecommendations);
                    GUIControl.FocusControl(GetID, genreButton.GetID);
                }
                return;
            }

            // sort shows
            var showList = shows.ToList();
            showList.Sort(new GUIListItemShowSorter(TraktSettings.SortByRecommendedShows.Field, TraktSettings.SortByRecommendedShows.Direction));

            int itemId = 0;
            var showImages = new List<GUITmdbImage>();

            foreach (var show in showList)
            {
                var item = new GUIShowListItem(show.Title, (int)TraktGUIWindows.RecommendationsShows);

                // add image for download
                var images = new GUITmdbImage { ShowImages = new TmdbShowImages { Id = show.Ids.Tmdb } };
                showImages.Add(images);

                item.Label2 = show.Year.ToString();
                item.TVTag = show;
                item.Show = show;
                item.Images = images;
                item.ItemId = Int32.MaxValue - itemId;
                item.IconImage = GUIImageHandler.GetDefaultPoster(false);
                item.IconImageBig = GUIImageHandler.GetDefaultPoster();
                item.ThumbnailImage = GUIImageHandler.GetDefaultPoster();
                item.OnItemSelected += OnShowSelected;
                Utils.SetDefaultIcons(item);
                Facade.Add(item);
                itemId++;
            }

            // Set Facade Layout
            Facade.SetCurrentLayout(Enum.GetName(typeof(Layout), CurrentLayout));
            GUIControl.FocusControl(GetID, Facade.GetID);

            if (PreviousSelectedIndex >= shows.Count())
                Facade.SelectIndex(PreviousSelectedIndex - 1);
            else
                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));

            // Download show images Async and set to facade
            GUIShowListItem.GetImages(showImages);
        }