internal void InitFacade(ref GUIFacadeControl facade) { if (Utils.UsedArgus) { if (Largusrh != null && Largusrh.FacadeCollection != null) { for (int i = 0; i < Largusrh.FacadeCollection.Count; i++) { GUIListItem _gc = Largusrh.FacadeCollection[i] as GUIListItem; // Utils.LoadImage(_gc.IconImage, ref Largusrh.imagesThumbs); facade.Add(_gc); } } } else { if (Ltvrh != null && Ltvrh.FacadeCollection != null) { for (int i = 0; i < Ltvrh.FacadeCollection.Count; i++) { GUIListItem _gc = Ltvrh.FacadeCollection[i] as GUIListItem; // Utils.LoadImage(_gc.IconImage, ref Ltvrh.imagesThumbs); facade.Add(_gc); } } } }
private void SendCrewToFacade(List <TraktPersonShowJob> crew) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (crew == null) { GUIUtils.ShowNotifyDialog(Translation.Error, Translation.ErrorGeneral); GUIWindowManager.ShowPreviousWindow(); return; } // filter Shows var filteredCrew = FilterCrewShows(crew).Where(m => !string.IsNullOrEmpty(m.Show.Title)).ToList(); // sort Shows filteredCrew.Sort(new GUIListItemShowSorter(TraktSettings.SortByCreditShows.Field, TraktSettings.SortByCreditShows.Direction)); int itemId = 0; GUIShowListItem item = null; var ShowImages = new List <GUITmdbImage>(); foreach (var job in filteredCrew) { // add image for download var images = new GUITmdbImage { ShowImages = new TmdbShowImages { Id = job.Show.Ids.Tmdb } }; ShowImages.Add(images); item = new GUIShowListItem(job.Show.Title, (int)TraktGUIWindows.PersonCreditShows); item.Label2 = job.Show.Year == null ? "----" : job.Show.Year.ToString(); item.Show = job.Show; item.TVTag = job; item.Images = images; item.ItemId = Int32.MaxValue - itemId; item.IconImage = GUIImageHandler.GetDefaultPoster(false); item.IconImageBig = GUIImageHandler.GetDefaultPoster(); item.ThumbnailImage = GUIImageHandler.GetDefaultPoster(); item.OnItemSelected += OnCrewSelected; Utils.SetDefaultIcons(item); Facade.Add(item); itemId++; } // Set Facade Layout Facade.CurrentLayout = CurrentLayout; GUIControl.FocusControl(GetID, Facade.GetID); Facade.SelectIndex(PreviousSelectedIndex); // set facade properties GUIUtils.SetProperty("#itemcount", Facade.Count.ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", filteredCrew.Count, filteredCrew.Count > 1 ? Translation.Shows : Translation.Show)); // Download Show images Async and set to facade GUIShowListItem.GetImages(ShowImages); }
private void SendTrendingListsToFacade(IEnumerable <TraktListTrending> lists) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (lists == null) { GUIUtils.ShowNotifyDialog(Translation.Error, Translation.ErrorGeneral); GUIWindowManager.ShowPreviousWindow(); return; } int itemId = 0; // Add each list foreach (var trending in lists) { var item = new GUIListItem(trending.List.Name.RemapHighOrderChars()); item.Label2 = string.Format("{0} {1}", trending.List.ItemCount, trending.List.ItemCount != 1 ? Translation.Items : Translation.Item); item.TVTag = trending; item.ItemId = Int32.MaxValue - itemId; item.PinImage = TraktLists.GetPrivacyLevelIcon(trending.List.Privacy); item.IconImage = "defaultFolder.png"; item.IconImageBig = "defaultFolderBig.png"; item.ThumbnailImage = "defaultFolderBig.png"; item.OnItemSelected += OnItemSelected; Utils.SetDefaultIcons(item); Facade.Add(item); itemId++; } // Set Facade Layout Facade.CurrentLayout = GUIFacadeControl.Layout.List; GUIControl.FocusControl(GetID, Facade.GetID); if (PreviousSelectedIndex >= lists.Count()) { Facade.SelectIndex(PreviousSelectedIndex - 1); } else { Facade.SelectIndex(PreviousSelectedIndex); } // set facade properties GUIUtils.SetProperty("#itemcount", lists.Count().ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", lists.Count().ToString(), lists.Count() > 1 ? Translation.Lists : Translation.List)); }
private void PopulateListControl(string path) { if (path.Equals("\\", StringComparison.Ordinal)) { GUIControl.SetControlLabel(WindowID, mainLabel.GetID, "Blast Zone"); } else { GUIControl.SetControlLabel(WindowID, mainLabel.GetID, path); } GUIControl.ClearControl(WindowID, facadeView.GetID); GUIListItem item; foreach (string collection in _menu.GetAllItems()) { if (path.Equals("\\", StringComparison.Ordinal)) { item = new GUIListItem(collection); item.IsFolder = true; item.Path = "\\"; item.IconImage = "defaultFolder.png"; item.IconImageBig = "defaultFolderBig.png"; facadeView.Add(item); } else if (collection.Equals(path, StringComparison.OrdinalIgnoreCase)) { item = new GUIListItem(".."); item.IsFolder = true; item.Path = "\\"; item.IconImage = "defaultFolderBack.png"; item.IconImageBig = "defaultFolderBackBig.png"; facadeView.Add(item); foreach (string command in _menu.GetItem(collection).GetAllItems()) { item = new GUIListItem(command); item.IsFolder = false; item.Path = collection; item.IconImage = "check-box.png"; facadeView.Add(item); } } } //string strObjects = String.Format("{0} {1}", GUIControl.GetItemCount(GetID, (int)Controls.CONTROL_LIST_DIR).ToString(), GUILocalizeStrings.Get(632)); //GUIPropertyManager.SetProperty("#itemcount", strObjects); }
public void SetItems(GUIFacadeControl control) { foreach (GUIListItem item in Items) { control.Add(item); } }
private void SendSearchResultsToFacade(IEnumerable <TraktEpisodeSummary> episodes) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (episodes == null || episodes.Count() == 0) { GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoSearchResultsFound); GUIWindowManager.ShowPreviousWindow(); Episodes = null; return; } int itemId = 0; var showImages = new List <TraktImage>(); // Add each show foreach (var episodeSummary in episodes) { // add images for download var images = new TraktImage { EpisodeImages = episodeSummary.Episode.Images, ShowImages = episodeSummary.Show.Images }; showImages.Add(images); var item = new GUIEpisodeListItem(episodeSummary.ToString(), (int)TraktGUIWindows.SearchEpisodes); item.Label2 = episodeSummary.Show.Year.ToString(); item.TVTag = episodeSummary; item.Images = images; item.IsPlayed = episodeSummary.Episode.Watched; item.ItemId = Int32.MaxValue - itemId; item.IconImage = "defaultTraktEpisode.png"; item.IconImageBig = "defaultTraktEpisodeBig.png"; item.ThumbnailImage = "defaultTraktEpisodeBig.png"; item.OnItemSelected += OnEpisodeSelected; Utils.SetDefaultIcons(item); Facade.Add(item); itemId++; } // Set Facade Layout Facade.SetCurrentLayout(Enum.GetName(typeof(Layout), CurrentLayout)); GUIControl.FocusControl(GetID, Facade.GetID); if (SearchTermChanged) { PreviousSelectedIndex = 0; } Facade.SelectIndex(PreviousSelectedIndex); // set facade properties GUIUtils.SetProperty("#itemcount", episodes.Count().ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", episodes.Count().ToString(), episodes.Count() > 1 ? Translation.Episodes : Translation.Episode)); // Download images Async and set to facade GUIEpisodeListItem.GetImages(showImages); }
private void AddToFilmstrip(GUIFacadeControl facade, Latest latests, int x) { try { Utils.LoadImage(latests.Thumb, ref imagesThumbs); //Add to filmstrip GUIListItem item = new GUIListItem(); item.ItemId = x; item.IconImage = latests.Thumb; item.IconImageBig = latests.Thumb; item.ThumbnailImage = latests.Thumb; item.Label = latests.Title; item.Label2 = latests.Genre; item.Label3 = latests.DateAdded; item.IsFolder = false; item.DVDLabel = latests.Fanart; item.OnItemSelected += new GUIListItem.ItemSelectedHandler(item_OnItemSelected); if (facade != null) { facade.Add(item); } facadeCollection.Add(item); if (x == 1) { UpdateSelectedProperties(item); } } catch (Exception ex) { logger.Error("AddToFilmstrip: " + ex.ToString()); } }
private void SendSearchResultsToFacade(IEnumerable <TraktSearchResult> searchResults) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (searchResults == null || searchResults.Count() == 0) { GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoSearchResultsFound); return; } // jump directly to results if (!TraktSettings.ShowSearchResultsBreakdown && SearchTypes.Count == 1) { // set the selected search type as we have not clicked on a facade item SelectedSearchType = (SearchType)GetSearchTypesID(); SendSearchResultsToWindow(SearchResults); // clear the search term so when we return (press back) we don't go in a loop. SearchTerm = null; return; } int itemId = 0; // Add each search type to the list foreach (var type in SearchTypes) { GUIListItem item = new GUIListItem(GetSearchListName(type)); item.Label2 = GetSearchResultCount(searchResults, type).ToString(); item.ItemId = Int32.MaxValue - itemId; item.TVTag = type; item.IconImage = "defaultFolder.png"; item.IconImageBig = "defaultFolderBig.png"; item.ThumbnailImage = "defaultFolderBig.png"; item.OnItemSelected += OnItemSelected; Utils.SetDefaultIcons(item); Facade.Add(item); itemId++; } // Set Facade Layout Facade.SetCurrentLayout("List"); GUIControl.FocusControl(GetID, Facade.GetID); if (PreviousSelectedIndex >= SearchTypes.Count) { Facade.SelectIndex(PreviousSelectedIndex - 1); } else { Facade.SelectIndex(PreviousSelectedIndex); } // set facade properties GUIUtils.SetProperty("#itemcount", SearchTypes.Count().ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", SearchTypes.Count.ToString(), Translation.SearchTypes)); }
private void ShowPosters() { GUIControl.ClearControl(this.GetID, m_Facade.GetID); List <PosterContainer> allPosters = new List <PosterContainer>(); string displayname = ""; AnimeSeriesVM ser = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID); if (ser != null) { displayname = ser.SeriesName; if (ser.CrossRef_AniDB_TvDBV2 != null && ser.CrossRef_AniDB_TvDBV2.Count > 0) { AnimeID = ser.CrossRef_AniDB_TvDBV2[0].AnimeID; } } BaseConfig.MyAnimeLog.Write("ShowPosters for {0} - {1}", displayname, AnimeID); foreach (PosterContainer pstr in ser.AniDB_Anime.AniDB_AnimeCrossRefs.AllPosters) { if (!File.Exists(pstr.FullImagePath)) { continue; } allPosters.Add(pstr); } GUIListItem item = null; foreach (PosterContainer poster in allPosters) { item = new GUIListItem(); item.IconImage = item.IconImageBig = poster.FullImagePath; item.TVTag = poster; item.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected); m_Facade.Add(item); } if (m_Facade.Count > 0) { m_Facade.SelectedListItemIndex = 0; // Work around for Filmstrip not allowing to programmatically select item if (m_Facade.CurrentLayout == GUIFacadeControl.Layout.Filmstrip) { } PosterContainer selectedPoster = m_Facade.SelectedListItem.TVTag as PosterContainer; if (selectedPoster != null) { SetPosterProperties(selectedPoster); } GUIControl.FocusControl(GetID, 50); } }
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; var seasonImages = new List <TraktImage>(); foreach (var season in seasons) { // add image for download var images = new TraktImage { SeasonImages = season.Images, ShowImages = Show.Images }; seasonImages.Add(images); string itemLabel = season.Season == 0 ? Translation.Specials : string.Format("{0} {1}", Translation.Season, season.Season.ToString()); var item = new GUISeasonListItem(itemLabel, (int)TraktGUIWindows.ShowSeasons); item.Label2 = string.Format("{0} {1}", season.EpisodeCount, Translation.Episodes); item.TVTag = season; item.Images = images; item.ItemId = Int32.MaxValue - itemId; item.IconImage = GUIImageHandler.GetDefaultPoster(false); item.IconImageBig = GUIImageHandler.GetDefaultPoster(); item.ThumbnailImage = GUIImageHandler.GetDefaultPoster(); item.OnItemSelected += OnSeasonSelected; Utils.SetDefaultIcons(item); Facade.Add(item); itemId++; } // 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 GUISeasonListItem.GetImages(seasonImages); }
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 SendSearchResultsToFacade(IEnumerable <TraktMovie> movies) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (movies == null || movies.Count() == 0) { GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoSearchResultsFound); GUIWindowManager.ShowPreviousWindow(); Movies = null; return; } int itemId = 0; var movieImages = new List <TraktImage>(); // Add each movie foreach (var movie in movies) { // add image for download var images = new TraktImage { MovieImages = movie.Images }; movieImages.Add(images); GUIMovieListItem item = new GUIMovieListItem(movie.Title, (int)TraktGUIWindows.SearchMovies); item.Label2 = movie.Year == "0" ? "----" : movie.Year; item.TVTag = movie; item.Images = images; item.IsPlayed = movie.Watched; item.ItemId = Int32.MaxValue - itemId; item.IconImage = GUIImageHandler.GetDefaultPoster(false); item.IconImageBig = GUIImageHandler.GetDefaultPoster(); item.ThumbnailImage = GUIImageHandler.GetDefaultPoster(); item.OnItemSelected += OnMovieSelected; Utils.SetDefaultIcons(item); Facade.Add(item); itemId++; } // Set Facade Layout Facade.SetCurrentLayout(Enum.GetName(typeof(Layout), CurrentLayout)); GUIControl.FocusControl(GetID, Facade.GetID); if (SearchTermChanged) { PreviousSelectedIndex = 0; } Facade.SelectIndex(PreviousSelectedIndex); // set facade properties GUIUtils.SetProperty("#itemcount", movies.Count().ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", movies.Count().ToString(), movies.Count() > 1 ? Translation.Movies : Translation.Movie)); // Download movie images Async and set to facade GUIMovieListItem.GetImages(movieImages); }
private void SendRelatedMoviesToFacade(IEnumerable <TraktMovie> movies) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (movies.Count() == 0) { string title = string.IsNullOrEmpty(relatedMovie.Title) ? relatedMovie.IMDbId : relatedMovie.Title; GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), string.Format(Translation.NoRelatedMovies, title)); GUIWindowManager.ShowPreviousWindow(); return; } int itemId = 0; var movieImages = new List <TraktImage>(); // Add each movie foreach (var movie in movies.Where(m => !string.IsNullOrEmpty(m.Title))) { var item = new GUIMovieListItem(movie.Title, (int)TraktGUIWindows.RelatedMovies); // add image for download var image = new TraktImage { MovieImages = movie.Images }; movieImages.Add(image); item.Label2 = movie.Year; item.TVTag = movie; item.Images = image; item.IsPlayed = movie.Watched; item.ItemId = Int32.MaxValue - itemId; // movie in collection doesnt nessararily mean // that the movie is locally available on this computer // as 'keep library clean' might not be enabled //item.IsRemote = !movie.InCollection; item.IconImage = GUIImageHandler.GetDefaultPoster(false); item.IconImageBig = GUIImageHandler.GetDefaultPoster(); item.ThumbnailImage = GUIImageHandler.GetDefaultPoster(); item.OnItemSelected += OnMovieSelected; Utils.SetDefaultIcons(item); Facade.Add(item); itemId++; } // Set Facade Layout Facade.SetCurrentLayout(Enum.GetName(typeof(Layout), CurrentLayout)); GUIControl.FocusControl(GetID, Facade.GetID); Facade.SelectIndex(PreviousSelectedIndex); // set facade properties GUIUtils.SetProperty("#itemcount", movies.Count().ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", movies.Count().ToString(), movies.Count() > 1 ? Translation.Movies : Translation.Movie)); // Download movie images Async and set to facade GUIMovieListItem.GetImages(movieImages); }
private void SendSearchResultsToFacade(IEnumerable <TraktPersonSummary> people) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (people == null || people.Count() == 0) { GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoSearchResultsFound); GUIWindowManager.ShowPreviousWindow(); People = null; return; } int itemId = 0; var personImages = new List <TraktImage>(); // Add each movie foreach (var person in people) { // add image for download var images = new TraktImage { PoepleImages = person.Images }; personImages.Add(images); var item = new GUIPersonListItem(person.Name.Trim(), (int)TraktGUIWindows.SearchPeople); item.TVTag = person; item.Images = images; item.ItemId = Int32.MaxValue - itemId; item.IconImage = GUIImageHandler.GetDefaultPoster(false); item.IconImageBig = GUIImageHandler.GetDefaultPoster(); item.ThumbnailImage = GUIImageHandler.GetDefaultPoster(); item.OnItemSelected += OnPersonSelected; Utils.SetDefaultIcons(item); Facade.Add(item); itemId++; } // Set Facade Layout Facade.SetCurrentLayout(Enum.GetName(typeof(Layout), CurrentLayout)); GUIControl.FocusControl(GetID, Facade.GetID); if (SearchTermChanged) { PreviousSelectedIndex = 0; } Facade.SelectIndex(PreviousSelectedIndex); // set facade properties GUIUtils.SetProperty("#itemcount", people.Count().ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", people.Count().ToString(), people.Count() > 1 ? Translation.People : Translation.Person)); // Download images Async and set to facade GUIPersonListItem.GetImages(personImages); }
private void SendSearchResultsToFacade(IEnumerable <TraktUser> users) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (users == null || users.Count() == 0) { GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoSearchResultsFound); GUIWindowManager.ShowPreviousWindow(); Users = null; return; } int itemId = 0; var userImages = new List <TraktImage>(); // Add each user foreach (var user in users) { // add image to download var images = new TraktImage { Avatar = user.Avatar }; userImages.Add(images); var item = new GUIUserListItem(user.Username, (int)TraktGUIWindows.SearchUsers); item.Images = images; item.TVTag = user; item.ItemId = Int32.MaxValue - itemId; item.IconImage = "defaultTraktUser.png"; item.IconImageBig = "defaultTraktUserBig.png"; item.ThumbnailImage = "defaultTraktUserBig.png"; item.OnItemSelected += OnUserSelected; Utils.SetDefaultIcons(item); Facade.Add(item); itemId++; } // Set Facade Layout Facade.SetCurrentLayout(Enum.GetName(typeof(Layout), CurrentLayout)); GUIControl.FocusControl(GetID, Facade.GetID); if (SearchTermChanged) { PreviousSelectedIndex = 0; } Facade.SelectIndex(PreviousSelectedIndex); // set facade properties GUIUtils.SetProperty("#itemcount", users.Count().ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", users.Count().ToString(), users.Count() > 1 ? Translation.Users : Translation.User)); // Download images Async and set to facade GUIUserListItem.GetImages(userImages); }
private void ShowFanart() { GUIControl.ClearControl(this.GetID, m_Facade.GetID); List <FanartContainer> allFanart = new List <FanartContainer>(); AnimeSeriesVM ser = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID); if (ser != null) { if (ser.CrossRef_AniDB_TvDBV2 != null && ser.CrossRef_AniDB_TvDBV2.Count > 0) { AnimeID = ser.CrossRef_AniDB_TvDBV2[0].AnimeID; } } if (ser == null) { return; } BaseConfig.MyAnimeLog.Write("ShowFanart for {0}", AnimeID); GUIListItem item = null; foreach (FanartContainer fanart in ser.AniDB_Anime.AniDB_AnimeCrossRefs.AllFanarts) { if (!File.Exists(fanart.FullImagePath)) { continue; } item = new GUIListItem(); item.IconImage = item.IconImageBig = fanart.FullThumbnailPath; item.TVTag = fanart; item.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected); m_Facade.Add(item); } if (m_Facade.Count > 0) { m_Facade.SelectedListItemIndex = 0; // Work around for Filmstrip not allowing to programmatically select item if (m_Facade.CurrentLayout == GUIFacadeControl.Layout.Filmstrip) { } FanartContainer selectedFanart = m_Facade.SelectedListItem.TVTag as FanartContainer; if (selectedFanart != null) { setFanartPreviewBackground(selectedFanart); } GUIControl.FocusControl(GetID, 50); } }
private void SendListItemsToFacade(TraktUserList list) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (list.Items == null || list.Items.Count() == 0) { GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoListItemsFound); GUIWindowManager.ShowPreviousWindow(); return; } int itemId = 1; var listImages = new List <TraktImage>(); // Add each list item foreach (var listItem in list.Items.Where(l => !string.IsNullOrEmpty(l.Title))) { // add image for download var images = GetTraktImage(listItem); listImages.Add(images); string itemName = list.ShowNumbers ? string.Format("{0}. {1}", itemId, GetListItemName(listItem)) : GetListItemName(listItem); var item = new GUICustomListItem(itemName, (int)TraktGUIWindows.ListItems); item.Label2 = listItem.Year; item.TVTag = listItem; item.Images = images; item.IsPlayed = listItem.Watched; item.ItemId = Int32.MaxValue - itemId; item.IconImage = GUIImageHandler.GetDefaultPoster(false); item.IconImageBig = GUIImageHandler.GetDefaultPoster(); item.ThumbnailImage = GUIImageHandler.GetDefaultPoster(); item.OnItemSelected += OnItemSelected; Utils.SetDefaultIcons(item); Facade.Add(item); itemId++; } // Set Facade Layout Facade.SetCurrentLayout(Enum.GetName(typeof(Layout), CurrentLayout)); GUIControl.FocusControl(GetID, Facade.GetID); Facade.SelectIndex(PreviousSelectedIndex); // set facade properties GUIUtils.SetProperty("#itemcount", list.Items.Count().ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", list.Items.Count().ToString(), list.Items.Count() > 1 ? Translation.Items : Translation.Item)); // Download images Async and set to facade GUICustomListItem.GetImages(listImages); }
private void SendRelatedShowsToFacade(IEnumerable <TraktShow> shows) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (shows.Count() == 0) { string title = string.IsNullOrEmpty(relatedShow.Title) ? relatedShow.TVDbId : relatedShow.Title; GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), string.Format(Translation.NoRelatedShows, title)); GUIWindowManager.ShowPreviousWindow(); return; } int itemId = 0; var showImages = new List <TraktImage>(); foreach (var show in shows) { var item = new GUIShowListItem(show.Title, (int)TraktGUIWindows.RelatedShows); // add image for download var images = new TraktImage { ShowImages = show.Images }; showImages.Add(images); item.Label2 = show.Year.ToString(); item.TVTag = 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); 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); }
private void RefreshCharacters() { charList = VM_ShokoServer.Instance.ShokoServices.GetCharactersForSeiyuu(MainWindow.GlobalSeiyuuID); foreach (CL_AniDB_Character aniChar in charList) { if (!string.IsNullOrEmpty(aniChar.GetPosterPath()) && File.Exists(aniChar.GetPosterPath())) { string imagePath = aniChar.GetPosterPath(); bool fnd = false; foreach (GUIListItem g in m_Facade.FilmstripLayout.ListItems) { CL_AniDB_Character ac = g.TVTag as CL_AniDB_Character; if (ac != null) { if (ac.CharID == aniChar.CharID) { fnd = true; g.IconImage = g.IconImageBig = imagePath; break; } } } if (!fnd) { GUIListItem item = new GUIListItem(string.Empty); item.IconImage = item.IconImageBig = imagePath; item.TVTag = aniChar; item.OnItemSelected += onFacadeItemSelected; m_Facade.Add(item); BaseConfig.MyAnimeLog.Write(aniChar.ToString()); } } } if (dummyCharactersExist != null) { dummyCharactersExist.Visible = charList.Count > 0; } SetGUIProperty(GuiProperty.Actors_Character_CharacterCount, charList.Count.ToString(Globals.Culture)); }
private void ShowBrowseResults(List<TorrentLink> results) { if (!dummyPageBrowse.Visible) return; m_Facade.Clear(); SetGUIProperty(GuiProperty.Browse_Source, EnumTranslator.TorrentSourceTranslated(curBrowseSource))); foreach (TorrentLink link in results) { GUIListItem item = new GUIListItem(); item.Label = string.Format("{0} ({1})", link.TorrentName, link.Size); item.TVTag = link; m_Facade.Add(item); } SetGUIProperty(GuiProperty.Browse_ResultDescription, string.Format("{0} {1}", results.Count, results.Count == 1 ? Translation.Result : Translation.Results)); m_Facade.Focus = true; }
private void SendListItemsToFacade(TraktUserList list) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (list.Items == null || list.Items.Count() == 0) { GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoListItemsFound); GUIWindowManager.ShowPreviousWindow(); return; } int itemId = 0; List <object> images = new List <object>(); // Add each list item foreach (var listItem in list.Items) { GUITraktCustomListItem item = new GUITraktCustomListItem(listItem.ToString()); item.Label2 = listItem.Year; item.TVTag = listItem; item.Item = listItem.Images; item.IsPlayed = listItem.Watched; item.ItemId = Int32.MaxValue - itemId; item.IconImage = "defaultVideo.png"; item.IconImageBig = "defaultVideoBig.png"; item.ThumbnailImage = "defaultVideoBig.png"; item.OnItemSelected += OnItemSelected; Utils.SetDefaultIcons(item); Facade.Add(item); itemId++; // add image for download images.Add(listItem.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", list.Items.Count().ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", list.Items.Count().ToString(), list.Items.Count() > 1 ? Translation.Items : Translation.Item)); // Download images Async and set to facade GetImages(images); }
/// <summary> /// Load Facade Control /// </summary> private void LoadPlaylist() { PlaylistControl.Clear(); var playlist = _playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_LAST_FM); foreach (var pli in playlist) { var pItem = new GUIListItem(pli.Description); var tag = (MusicTag)pli.MusicTag; var dirtyTag = false; if (tag != null) { pItem.MusicTag = tag; if (tag.Title == ("unknown") || tag.Title.IndexOf("unknown") > 0 || tag.Title == string.Empty) { dirtyTag = true; } } else { dirtyTag = true; } if (tag != null && !dirtyTag) { var duration = Util.Utils.SecondsToHMSString(tag.Duration); pItem.Label = string.Format("{0} - {1}", tag.Artist, tag.Title); pItem.Label2 = duration; pItem.MusicTag = pli.MusicTag; } pItem.Path = pli.FileName; pItem.IsFolder = false; if (pli.Played) { pItem.Shaded = true; } Util.Utils.SetDefaultIcons(pItem); pItem.OnRetrieveArt += OnRetrieveCoverArt; PlaylistControl.Add(pItem); } //select first item in list (this will update selected thumb skin property) GUIControl.SelectItemControl(GetID, PlaylistControl.GetID, 0); }
private void ShowBrowseResults(List <TorrentLink> results) { if (!dummyPageBrowse.Visible) { return; } m_Facade.Clear(); setGUIProperty("Browse.Source", DownloadHelper.GetTorrentSourceDescription(curBrowseSource)); foreach (TorrentLink link in results) { GUIListItem item = null; item = new GUIListItem(); item.Label = string.Format("{1} ({2})", link.Source, link.TorrentName, link.Size); item.TVTag = link; m_Facade.Add(item); } setGUIProperty("Browse.ResultDescription", string.Format("{0} Results", results.Count)); m_Facade.Focus = true; }
void workerRefreshUnlinkedFiles_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { List <GUIListItem> listItems = e.Result as List <GUIListItem>; foreach (GUIListItem itm in listItems) { m_Facade.Add(itm); } setGUIProperty("Utilities.UnlinkedFilesCount", listItems.Count.ToString()); if (listItems.Count > 0) { m_Facade.SelectedListItemIndex = 0; m_Facade.Focus = true; } }
void workerRefreshUnlinkedFiles_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { List <GUIListItem> listItems = e.Result as List <GUIListItem>; if (listItems != null) { foreach (GUIListItem itm in listItems) { m_Facade.Add(itm); } SetGUIProperty(GuiProperty.Utilities_UnlinkedFilesCount, listItems.Count.ToString(CultureInfo.CurrentCulture)); if (listItems.Count > 0) { m_Facade.SelectedListItemIndex = 0; m_Facade.Focus = true; } } }
private void ShowWideBanners() { GUIControl.ClearControl(this.GetID, m_Facade.GetID); AnimeSeriesVM ser = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID); if (ser != null) { if (ser.CrossRef_AniDB_TvDBV2 != null && ser.CrossRef_AniDB_TvDBV2.Count > 0) { AnimeID = ser.CrossRef_AniDB_TvDBV2[0].AnimeID; } } if (ser != null) { List <TvDB_ImageWideBannerVM> tvDBWideBanners = ser.AniDB_Anime.AniDB_AnimeCrossRefs.TvDBImageWideBanners; GUIListItem item = null; foreach (TvDB_ImageWideBannerVM banner in tvDBWideBanners) { item = new GUIListItem(); item.IconImage = item.IconImageBig = banner.FullImagePath; item.TVTag = banner; item.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected); m_Facade.Add(item); } if (m_Facade.Count > 0) { m_Facade.SelectedListItemIndex = 0; TvDB_ImageWideBannerVM selectedBanner = m_Facade.SelectedListItem.TVTag as TvDB_ImageWideBannerVM; if (selectedBanner != null) { SetWideBannerProperties(selectedBanner); } GUIControl.FocusControl(GetID, 50); } } }
void getDataWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { colRecs = e.Result as List <VM_Recommendation>; if (colRecs == null || colRecs.Count == 0) { if (dummyAnyRecords != null) { dummyAnyRecords.Visible = false; } SetGUIProperty(GuiProperty.Recommendations_Status, Translation.NoRecommendationsAvailable); return; } if (dummyAnyRecords != null) { dummyAnyRecords.Visible = true; } foreach (VM_Recommendation rec in colRecs) { GUIListItem item = new GUIListItem(""); //AniDB_AnimeVM anime = rec.AnimeSeries.AniDB_Anime; item.IconImage = item.IconImageBig = rec.Recommended_PosterPath; item.TVTag = rec; item.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected); m_Facade.Add(item); } if (m_Facade.Count > 0) { m_Facade.SelectedListItemIndex = 0; VM_Recommendation rec = m_Facade.SelectedListItem.TVTag as VM_Recommendation; if (rec != null) { SetRec(rec); } } }
void ShowBoutiques() { _Url = "http://" + server; _UserName = ""; _Password = ""; //_ShowChannels = false; facadeview.Clear(); //get bouquets Data _DBox = new Data(_Url, _UserName, _Password); _TV_Bouquets = _DBox.UserTVBouquets.Tables[0]; foreach (DataRow row in _TV_Bouquets.Rows) { GUIListItem li = new GUIListItem(); li.Label = row["Name"].ToString(); facadeview.Add(li); } }
private void LoadFacade(List <DBActor> actors) { // clear facade GUIControl.ClearControl(GetID, FacadeActors.GetID); // set number of actors property GUIPropertyManager.SetProperty("#itemcount", actors.Count().ToString()); // notify user if no actors to display and backout of window if (actors.Count == 0) { SetProperty("NoActors", Translation.NoActors); TVSeriesPlugin.ShowNotifyDialog(Translation.Actors, Translation.NoActors); GUIWindowManager.ShowPreviousWindow(); } // Add each actor to the list foreach (var actor in actors) { GUIActorListItem actorItem = new GUIActorListItem(actor.ToString()); actorItem.Item = actor; actorItem.IconImage = "defaultActor.png"; actorItem.IconImageBig = "defaultActor.png"; actorItem.ThumbnailImage = "defaultActor.png"; actorItem.OnItemSelected += OnActorSelected; Utils.SetDefaultIcons(actorItem); FacadeActors.Add(actorItem); } FacadeActors.SelectedListItemIndex = 0; // Download actor images async and set to facade GetImages(actors); // Set Facade Layout FacadeActors.CurrentLayout = (GUIFacadeControl.Layout)CurrentLayout; GUIControl.FocusControl(GetID, FacadeActors.GetID); }
protected void FillRelatedList() { //if (GUIWindowManager.ActiveWindow != GetID) // return; if (listControl == null) { return; } GUIControl.ClearControl(GetID, listControl.GetID); if (relatated == null || relatated.Count < 1) { return; } foreach (GUIListItem item in relatated) { listControl.Add(item); item.RefreshCoverArt(); } listControl.SelectedListItemIndex = 0; OnDownloadTimedEvent(null, null); GUIPropertyManager.SetProperty("#itemcount", listControl.Count.ToString()); }