private void RateItem(TraktListItem item)
 {
     if (SelectedType == TraktItemType.movie)
     {
         GUICommon.RateMovie(item.Movie);
     }
     else if (SelectedType == TraktItemType.show)
     {
         GUICommon.RateShow(item.Show);
     }
     else if (SelectedType == TraktItemType.episode)
     {
         GUICommon.RateEpisode(item.Show, item.Episode);
     }
 }
예제 #2
0
        protected override void OnShowContextMenu()
        {
            var selectedItem = this.Facade.SelectedListItem;

            if (selectedItem == null)
            {
                return;
            }

            var selectedShow = selectedItem.TVTag as TraktWatchListShow;

            if (selectedShow == null)
            {
                return;
            }

            var dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(GUIUtils.PluginName());

            GUIListItem listItem = null;

            // Show Season Information
            listItem = new GUIListItem(Translation.ShowSeasonInfo);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.ShowSeasonInfo;

            if (CurrentUser == TraktSettings.Username)
            {
                listItem = new GUIListItem(Translation.RemoveFromWatchList);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList;
            }
            else if (!selectedShow.InWatchList)
            {
                // viewing someone else's watch list and not in yours
                listItem = new GUIListItem(Translation.AddToWatchList);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.AddToWatchList;
            }

            // Add to Custom List
            listItem = new GUIListItem(Translation.AddToList + "...");
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.AddToList;

            if (TraktHelper.IsOnlineVideosAvailableAndEnabled)
            {
                listItem = new GUIListItem(Translation.Trailers);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.Trailers;
            }

            // Related Shows
            listItem = new GUIListItem(Translation.RelatedShows + "...");
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Related;

            // Rate Show
            listItem = new GUIListItem(Translation.RateShow);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Rate;

            // Shouts
            listItem = new GUIListItem(Translation.Shouts + "...");
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Shouts;

            // Change Layout
            listItem = new GUIListItem(Translation.ChangeLayout);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.ChangeLayout;

            if (TraktHelper.IsMpNZBAvailableAndEnabled)
            {
                // Search for show with mpNZB
                listItem = new GUIListItem(Translation.SearchWithMpNZB);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB;
            }

            if (TraktHelper.IsMyTorrentsAvailableAndEnabled)
            {
                // Search for show with MyTorrents
                listItem = new GUIListItem(Translation.SearchTorrent);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.SearchTorrent;
            }

            // Show Context Menu
            dlg.DoModal(GUIWindowManager.ActiveWindow);
            if (dlg.SelectedId < 0)
            {
                return;
            }

            switch (dlg.SelectedId)
            {
            case ((int)ContextMenuItem.ShowSeasonInfo):
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.ShowSeasons, selectedShow.ToJSON());
                break;

            case ((int)ContextMenuItem.AddToWatchList):
                TraktHelper.AddShowToWatchList(selectedShow);
                selectedShow.InWatchList = true;
                OnShowSelected(selectedItem, Facade);
                (Facade.SelectedListItem as GUIShowListItem).Images.NotifyPropertyChanged("Poster");
                break;

            case ((int)ContextMenuItem.RemoveFromWatchList):
                PreviousSelectedIndex = this.Facade.SelectedListItemIndex;
                TraktHelper.RemoveShowFromWatchList(selectedShow);
                if (_WatchListShows.Count() >= 1)
                {
                    // remove from list
                    var showsToExcept = new List <TraktWatchListShow>();
                    showsToExcept.Add(selectedShow);
                    _WatchListShows            = WatchListShows.Except(showsToExcept);
                    userWatchList[CurrentUser] = _WatchListShows;
                    LoadWatchListShows();
                }
                else
                {
                    // no more shows left
                    ClearProperties();
                    GUIControl.ClearControl(GetID, Facade.GetID);
                    _WatchListShows = null;
                    userWatchList.Remove(CurrentUser);
                    // notify and exit
                    GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoShowWatchList);
                    GUIWindowManager.ShowPreviousWindow();
                    return;
                }
                break;

            case ((int)ContextMenuItem.AddToList):
                TraktHelper.AddRemoveShowInUserList(selectedShow.Title, selectedShow.Year.ToString(), selectedShow.Tvdb, false);
                break;

            case ((int)ContextMenuItem.Related):
                TraktHelper.ShowRelatedShows(selectedShow);
                break;

            case ((int)ContextMenuItem.Rate):
                GUICommon.RateShow(selectedShow);
                OnShowSelected(selectedItem, Facade);
                (Facade.SelectedListItem as GUIShowListItem).Images.NotifyPropertyChanged("Poster");
                if (CurrentUser != TraktSettings.Username)
                {
                    GUIWatchListShows.ClearCache(TraktSettings.Username);
                }
                break;

            case ((int)ContextMenuItem.Shouts):
                TraktHelper.ShowTVShowShouts(selectedShow);
                break;

            case ((int)ContextMenuItem.Trailers):
                GUICommon.ShowTVShowTrailersMenu(selectedShow);
                break;

            case ((int)ContextMenuItem.ChangeLayout):
                CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout, PreviousSelectedIndex);
                break;

            case ((int)ContextMenuItem.SearchWithMpNZB):
                string loadingParam = string.Format("search:{0}", selectedShow.Title);
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam);
                break;

            case ((int)ContextMenuItem.SearchTorrent):
                string loadPar = selectedShow.Title;
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar);
                break;

            default:
                break;
            }

            base.OnShowContextMenu();
        }
        protected override void OnShowContextMenu()
        {
            var selectedItem = this.Facade.SelectedListItem as GUIShowListItem;

            if (selectedItem == null)
            {
                return;
            }

            var selectedPopularItem = selectedItem.TVTag as TraktShowSummary;

            if (selectedPopularItem == null)
            {
                return;
            }

            var dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(GUIUtils.PluginName());

            GUICommon.CreateShowsContextMenu(ref dlg, selectedPopularItem, false);

            // Show Context Menu
            dlg.DoModal(GUIWindowManager.ActiveWindow);
            if (dlg.SelectedId < 0)
            {
                return;
            }

            switch (dlg.SelectedId)
            {
            case ((int)MediaContextMenuItem.AddToWatchList):
                TraktHelper.AddShowToWatchList(selectedPopularItem);
                OnShowSelected(selectedItem, Facade);
                (Facade.SelectedListItem as GUIShowListItem).Images.NotifyPropertyChanged("Poster");
                if (TraktSettings.PopularShowsHideWatchlisted)
                {
                    LoadPopularShows(CurrentPage);
                }
                break;

            case ((int)MediaContextMenuItem.ShowSeasonInfo):
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.ShowSeasons, selectedPopularItem.ToJSON());
                break;

            case ((int)MediaContextMenuItem.MarkAsWatched):
                GUICommon.MarkShowAsWatched(selectedPopularItem);
                if (TraktSettings.PopularShowsHideWatched)
                {
                    LoadPopularShows(CurrentPage);
                }
                break;

            case ((int)MediaContextMenuItem.AddToLibrary):
                GUICommon.AddShowToCollection(selectedPopularItem);
                if (TraktSettings.PopularShowsHideCollected)
                {
                    LoadPopularShows(CurrentPage);
                }
                break;

            case ((int)MediaContextMenuItem.RemoveFromWatchList):
                TraktHelper.RemoveShowFromWatchList(selectedPopularItem);
                OnShowSelected(selectedItem, Facade);
                (Facade.SelectedListItem as GUIShowListItem).Images.NotifyPropertyChanged("Poster");
                break;

            case ((int)MediaContextMenuItem.AddToList):
                TraktHelper.AddRemoveShowInUserList(selectedPopularItem, false);
                break;

            case ((int)MediaContextMenuItem.Filters):
                if (ShowTVShowFiltersMenu())
                {
                    PreviousSelectedIndex = CurrentPage == 1 ? 0 : 1;
                    UpdateButtonState();
                    LoadPopularShows(CurrentPage);
                }
                break;

            case ((int)MediaContextMenuItem.Related):
                TraktHelper.ShowRelatedShows(selectedPopularItem);
                break;

            case ((int)MediaContextMenuItem.Trailers):
                GUICommon.ShowTVShowTrailersMenu(selectedPopularItem);
                break;

            case ((int)MediaContextMenuItem.Shouts):
                TraktHelper.ShowTVShowShouts(selectedPopularItem);
                break;

            case ((int)MediaContextMenuItem.Rate):
                GUICommon.RateShow(selectedPopularItem);
                OnShowSelected(selectedItem, Facade);
                (Facade.SelectedListItem as GUIShowListItem).Images.NotifyPropertyChanged("Poster");
                if (TraktSettings.PopularShowsHideRated)
                {
                    LoadPopularShows(CurrentPage);
                }
                break;

            case ((int)MediaContextMenuItem.Cast):
                GUICreditsShow.Show   = selectedPopularItem;
                GUICreditsShow.Type   = GUICreditsShow.CreditType.Cast;
                GUICreditsShow.Fanart = TmdbCache.GetShowBackdropFilename(selectedItem.Images.ShowImages);
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsShow);
                break;

            case ((int)MediaContextMenuItem.Crew):
                GUICreditsShow.Show   = selectedPopularItem;
                GUICreditsShow.Type   = GUICreditsShow.CreditType.Crew;
                GUICreditsShow.Fanart = TmdbCache.GetShowBackdropFilename(selectedItem.Images.ShowImages);
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsShow);
                break;

            case ((int)MediaContextMenuItem.ChangeLayout):
                CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout, PreviousSelectedIndex);
                break;

            case ((int)MediaContextMenuItem.SearchWithMpNZB):
                string loadingParam = string.Format("search:{0}", selectedPopularItem.Title);
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam);
                break;

            case ((int)MediaContextMenuItem.SearchTorrent):
                string loadPar = selectedPopularItem.Title;
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar);
                break;

            default:
                break;
            }

            base.OnShowContextMenu();
        }
예제 #4
0
        protected override void OnShowContextMenu()
        {
            if (GUIBackgroundTask.Instance.IsBusy)
            {
                return;
            }

            var selectedItem = this.Facade.SelectedListItem;

            if (selectedItem == null)
            {
                return;
            }

            var selectedShow = (TraktShow)selectedItem.TVTag;

            var dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(GUIUtils.PluginName());

            GUIListItem listItem = null;

            // Show Season Information
            listItem = new GUIListItem(Translation.ShowSeasonInfo);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.ShowSeasonInfo;

            // Hide/Show Watched items
            listItem = new GUIListItem(HideWatched ? Translation.ShowWatched : Translation.HideWatched);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.HideShowWatched;

            // Mark Show As Watched
            listItem = new GUIListItem(Translation.MarkAsWatched);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.MarkAsWatched;

            // Add Show to Library
            listItem = new GUIListItem(Translation.AddToLibrary);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.AddToLibrary;

            // Add/Remove Watch List
            if (!selectedShow.InWatchList)
            {
                listItem = new GUIListItem(Translation.AddToWatchList);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.AddToWatchList;
            }
            else
            {
                listItem = new GUIListItem(Translation.RemoveFromWatchList);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList;
            }

            // Add to Custom List
            listItem = new GUIListItem(Translation.AddToList + "...");
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.AddToList;

            if (TraktHelper.IsOnlineVideosAvailableAndEnabled)
            {
                listItem = new GUIListItem(Translation.Trailers);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.Trailers;
            }

            // Related Shows
            listItem = new GUIListItem(Translation.RelatedShows + "...");
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Related;

            // Rate Show
            listItem = new GUIListItem(Translation.RateShow);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Rate;

            // Shouts
            listItem = new GUIListItem(Translation.Shouts + "...");
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Shouts;

            // Change Layout
            listItem = new GUIListItem(Translation.ChangeLayout);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.ChangeLayout;

            if (TraktHelper.IsMpNZBAvailableAndEnabled)
            {
                // Search for show with mpNZB
                listItem = new GUIListItem(Translation.SearchWithMpNZB);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB;
            }

            if (TraktHelper.IsMyTorrentsAvailableAndEnabled)
            {
                // Search for show with MyTorrents
                listItem = new GUIListItem(Translation.SearchTorrent);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.SearchTorrent;
            }

            // Show Context Menu
            dlg.DoModal(GUIWindowManager.ActiveWindow);
            if (dlg.SelectedId < 0)
            {
                return;
            }

            switch (dlg.SelectedId)
            {
            case ((int)ContextMenuItem.ShowSeasonInfo):
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.ShowSeasons, selectedShow.ToJSON());
                break;

            case ((int)ContextMenuItem.HideShowWatched):
                HideWatched = !HideWatched;
                if (hideWatchedButton != null)
                {
                    hideWatchedButton.Selected = HideWatched;
                }
                dictRelatedShows.Remove(relatedShow.Slug);
                LoadRelatedShows();
                break;

            case ((int)ContextMenuItem.MarkAsWatched):
                GUICommon.MarkShowAsSeen(selectedShow);
                break;

            case ((int)ContextMenuItem.AddToLibrary):
                GUICommon.AddShowToLibrary(selectedShow);
                break;

            case ((int)ContextMenuItem.AddToWatchList):
                TraktHelper.AddShowToWatchList(selectedShow);
                selectedShow.InWatchList = true;
                OnShowSelected(selectedItem, Facade);
                (Facade.SelectedListItem as GUIShowListItem).Images.NotifyPropertyChanged("Poster");
                break;

            case ((int)ContextMenuItem.RemoveFromWatchList):
                TraktHelper.RemoveShowFromWatchList(selectedShow);
                selectedShow.InWatchList = false;
                OnShowSelected(selectedItem, Facade);
                (Facade.SelectedListItem as GUIShowListItem).Images.NotifyPropertyChanged("Poster");
                break;

            case ((int)ContextMenuItem.AddToList):
                TraktHelper.AddRemoveShowInUserList(selectedShow.Title, selectedShow.Year.ToString(), selectedShow.Tvdb, false);
                break;

            case ((int)ContextMenuItem.Trailers):
                GUICommon.ShowTVShowTrailersMenu(selectedShow);
                break;

            case ((int)ContextMenuItem.Shouts):
                TraktHelper.ShowTVShowShouts(selectedShow);
                break;

            case ((int)ContextMenuItem.Related):
                RelatedShow relShow = new RelatedShow
                {
                    Title  = selectedShow.Title,
                    TVDbId = selectedShow.Tvdb
                };
                relatedShow = relShow;
                LoadRelatedShows();
                GUIUtils.SetProperty("#Trakt.Related.Show", relatedShow.Title);
                RelationChanged = true;
                break;

            case ((int)ContextMenuItem.Rate):
                GUICommon.RateShow(selectedShow);
                OnShowSelected(selectedItem, Facade);
                (Facade.SelectedListItem as GUIShowListItem).Images.NotifyPropertyChanged("Poster");
                break;

            case ((int)ContextMenuItem.ChangeLayout):
                CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout, PreviousSelectedIndex);
                break;

            case ((int)ContextMenuItem.SearchWithMpNZB):
                string loadingParam = string.Format("search:{0}", selectedShow.Title);
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam);
                break;

            case ((int)ContextMenuItem.SearchTorrent):
                string loadPar = selectedShow.Title;
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar);
                break;

            default:
                break;
            }

            base.OnShowContextMenu();
        }
        protected override void OnShowContextMenu()
        {
            var selectedItem = this.Facade.SelectedListItem;

            if (selectedItem == null)
            {
                return;
            }

            var selectedComment = selectedItem.TVTag as TraktCommentItem;

            if (selectedComment == null)
            {
                return;
            }

            var dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(GUIUtils.PluginName());

            GUIListItem listItem = null;

            // Like or Unlike Comment
            if (CurrentUser != TraktSettings.Username)
            {
                // Like
                if (!selectedComment.Comment.IsLiked())
                {
                    listItem = new GUIListItem(Translation.Like);
                    dlg.Add(listItem);
                    listItem.ItemId = (int)ActivityContextMenuItem.Like;
                }
                else
                {
                    // UnLike
                    listItem = new GUIListItem(Translation.UnLike);
                    dlg.Add(listItem);
                    listItem.ItemId = (int)ActivityContextMenuItem.Unlike;
                }
            }

            listItem = new GUIListItem(TraktSettings.HideSpoilersOnShouts ? Translation.ShowSpoilers : Translation.HideSpoilers);
            dlg.Add(listItem);
            listItem.ItemId = (int)ActivityContextMenuItem.Spoilers;

            // if selected activity is an episode or show, add 'Season Info'
            if (selectedComment.Show != null)
            {
                listItem = new GUIListItem(Translation.ShowSeasonInfo);
                dlg.Add(listItem);
                listItem.ItemId = (int)ActivityContextMenuItem.ShowSeasonInfo;
            }

            // get a list of common actions to perform on the selected item
            if (selectedComment.Movie != null || selectedComment.Show != null)
            {
                var listItems = GetContextMenuItemsForComment(selectedComment);
                foreach (var item in listItems)
                {
                    int itemId = item.ItemId;
                    dlg.Add(item);
                    item.ItemId = itemId;
                }
            }

            // Show Context Menu
            dlg.DoModal(GUIWindowManager.ActiveWindow);
            if (dlg.SelectedId < 0)
            {
                return;
            }

            switch (dlg.SelectedId)
            {
            case (int)ActivityContextMenuItem.Like:
                GUICommon.LikeComment(selectedComment.Comment);
                selectedComment.Comment.Likes++;
                PublishCommentSkinProperties(selectedComment);
                break;

            case (int)ActivityContextMenuItem.Unlike:
                GUICommon.UnLikeComment(selectedComment.Comment);
                if (selectedComment.Comment.Likes > 0)
                {
                    selectedComment.Comment.Likes--;
                    PublishCommentSkinProperties(selectedComment);
                }
                break;

            case ((int)ActivityContextMenuItem.Spoilers):
                TraktSettings.HideSpoilersOnShouts = !TraktSettings.HideSpoilersOnShouts;
                if (hideSpoilersButton != null)
                {
                    hideSpoilersButton.Selected = TraktSettings.HideSpoilersOnShouts;
                }
                PublishCommentSkinProperties(selectedComment);
                break;

            case ((int)ActivityContextMenuItem.ShowSeasonInfo):
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.ShowSeasons, selectedComment.Show.ToJSON());
                break;

            case ((int)ActivityContextMenuItem.AddToList):
                if (selectedComment.Movie != null)
                {
                    TraktHelper.AddRemoveMovieInUserList(selectedComment.Movie, false);
                }
                else if (selectedComment.Episode != null)
                {
                    TraktHelper.AddRemoveEpisodeInUserList(selectedComment.Episode, false);
                }
                else
                {
                    TraktHelper.AddRemoveShowInUserList(selectedComment.Show, false);
                }
                break;

            case ((int)ActivityContextMenuItem.AddToWatchList):
                if (selectedComment.Movie != null)
                {
                    TraktHelper.AddMovieToWatchList(selectedComment.Movie, true);
                }
                else if (selectedComment.Episode != null)
                {
                    TraktHelper.AddEpisodeToWatchList(selectedComment.Episode);
                }
                else
                {
                    TraktHelper.AddShowToWatchList(selectedComment.Show);
                }
                break;

            case ((int)ActivityContextMenuItem.Shouts):
                if (selectedComment.Movie != null)
                {
                    TraktHelper.ShowMovieShouts(selectedComment.Movie);
                }
                else if (selectedComment.Episode != null)
                {
                    TraktHelper.ShowEpisodeShouts(selectedComment.Show, selectedComment.Episode);
                }
                else
                {
                    TraktHelper.ShowTVShowShouts(selectedComment.Show);
                }
                break;

            case ((int)ActivityContextMenuItem.Rate):
                if (selectedComment.Movie != null)
                {
                    GUICommon.RateMovie(selectedComment.Movie);
                }
                else if (selectedComment.Episode != null)
                {
                    GUICommon.RateEpisode(selectedComment.Show, selectedComment.Episode);
                }
                else
                {
                    GUICommon.RateShow(selectedComment.Show);
                }
                break;

            case ((int)ActivityContextMenuItem.Cast):
                if (selectedComment.Movie != null)
                {
                    GUICreditsMovie.Movie  = selectedComment.Movie;
                    GUICreditsMovie.Type   = GUICreditsMovie.CreditType.Cast;
                    GUICreditsMovie.Fanart = TmdbCache.GetMovieBackdropFilename((selectedItem as GUIMovieListItem).Images.MovieImages);
                    GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsMovie);
                }
                else if (selectedComment.Show != null)
                {
                    GUICreditsShow.Show   = selectedComment.Show;
                    GUICreditsShow.Type   = GUICreditsShow.CreditType.Cast;
                    GUICreditsShow.Fanart = TmdbCache.GetShowBackdropFilename((selectedItem as GUIShowListItem).Images.ShowImages);
                    GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsShow);
                }
                break;

            case ((int)ActivityContextMenuItem.Crew):
                if (selectedComment.Movie != null)
                {
                    GUICreditsMovie.Movie  = selectedComment.Movie;
                    GUICreditsMovie.Type   = GUICreditsMovie.CreditType.Crew;
                    GUICreditsMovie.Fanart = TmdbCache.GetMovieBackdropFilename((selectedItem as GUIMovieListItem).Images.MovieImages);
                    GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsMovie);
                }
                else if (selectedComment.Show != null)
                {
                    GUICreditsShow.Show   = selectedComment.Show;
                    GUICreditsShow.Type   = GUICreditsShow.CreditType.Crew;
                    GUICreditsShow.Fanart = TmdbCache.GetShowBackdropFilename((selectedItem as GUIShowListItem).Images.ShowImages);
                    GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsShow);
                }
                break;

            case ((int)ActivityContextMenuItem.Trailers):
                if (selectedComment.Movie != null)
                {
                    GUICommon.ShowMovieTrailersMenu(selectedComment.Movie);
                }
                else
                {
                    GUICommon.ShowTVShowTrailersMenu(selectedComment.Show, selectedComment.Episode);
                }
                break;
            }

            base.OnShowContextMenu();
        }
        protected override void OnShowContextMenu()
        {
            var selectedItem = this.Facade.SelectedListItem as GUIShowListItem;

            if (selectedItem == null)
            {
                return;
            }

            var selectedShow = selectedItem.TVTag as TraktShowSummary;

            if (selectedShow == null)
            {
                return;
            }

            IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(GUIUtils.PluginName());

            GUIListItem listItem = null;

            listItem = new GUIListItem(Translation.DismissRecommendation);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.DismissRecommendation;

            // Show Season Information
            listItem = new GUIListItem(Translation.ShowSeasonInfo);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.ShowSeasonInfo;

            // Add/Remove Watchlist
            if (!selectedShow.IsWatchlisted())
            {
                listItem = new GUIListItem(Translation.AddToWatchList);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.AddToWatchList;
            }
            else
            {
                listItem = new GUIListItem(Translation.RemoveFromWatchList);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList;
            }

            listItem = new GUIListItem(Translation.AddToList);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.AddToList;

            if (TraktHelper.IsTrailersAvailableAndEnabled)
            {
                listItem = new GUIListItem(Translation.Trailers);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.Trailers;
            }

            // Related Shows
            listItem = new GUIListItem(Translation.RelatedShows);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Related;

            // Rate Show
            listItem = new GUIListItem(Translation.RateShow);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Rate;

            // Shouts
            listItem = new GUIListItem(Translation.Comments);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Shouts;

            // Cast and Crew
            listItem = new GUIListItem(Translation.Cast);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Cast;

            listItem = new GUIListItem(Translation.Crew);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Crew;

            // Change Layout
            listItem = new GUIListItem(Translation.ChangeLayout);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.ChangeLayout;

            if (TraktHelper.IsMpNZBAvailableAndEnabled)
            {
                // Search for show with mpNZB
                listItem = new GUIListItem(Translation.SearchWithMpNZB);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB;
            }

            if (TraktHelper.IsMyTorrentsAvailableAndEnabled)
            {
                // Search for show with MyTorrents
                listItem = new GUIListItem(Translation.SearchTorrent);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.SearchTorrent;
            }

            // Show Context Menu
            dlg.DoModal(GUIWindowManager.ActiveWindow);
            if (dlg.SelectedId < 0)
            {
                return;
            }

            switch (dlg.SelectedId)
            {
            case ((int)ContextMenuItem.DismissRecommendation):
                PreviousSelectedIndex = this.Facade.SelectedListItemIndex;
                DismissRecommendation(selectedShow);
                if (_RecommendedShows.Count() > 1)
                {
                    var showsToExcept = new List <TraktShowSummary>();
                    showsToExcept.Add(selectedShow);
                    _RecommendedShows = RecommendedShows.Except(showsToExcept);
                }
                else
                {
                    // reload, none left
                    ClearProperties();
                    GUIControl.ClearControl(GetID, Facade.GetID);
                    _RecommendedShows = null;
                }
                LoadRecommendedShows();
                break;

            case ((int)ContextMenuItem.ShowSeasonInfo):
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.ShowSeasons, selectedShow.ToJSON());
                break;

            case ((int)ContextMenuItem.AddToWatchList):
                TraktHelper.AddShowToWatchList(selectedShow);
                OnShowSelected(selectedItem, Facade);
                (Facade.SelectedListItem as GUIShowListItem).Images.NotifyPropertyChanged("Poster");
                break;

            case ((int)ContextMenuItem.RemoveFromWatchList):
                TraktHelper.RemoveShowFromWatchList(selectedShow);
                OnShowSelected(selectedItem, Facade);
                (Facade.SelectedListItem as GUIShowListItem).Images.NotifyPropertyChanged("Poster");
                break;

            case ((int)ContextMenuItem.AddToList):
                TraktHelper.AddRemoveShowInUserList(selectedShow, false);
                break;

            case ((int)ContextMenuItem.Related):
                TraktHelper.ShowRelatedShows(selectedShow);
                break;

            case ((int)ContextMenuItem.Trailers):
                GUICommon.ShowTVShowTrailersMenu(selectedShow);
                break;

            case ((int)ContextMenuItem.Shouts):
                TraktHelper.ShowTVShowShouts(selectedShow);
                break;

            case ((int)ContextMenuItem.Rate):
                PreviousSelectedIndex = this.Facade.SelectedListItemIndex;
                if (GUICommon.RateShow(selectedShow))
                {
                    // remove from recommendations
                    if (_RecommendedShows.Count() > 1)
                    {
                        var showsToExcept = new List <TraktShowSummary>();
                        showsToExcept.Add(selectedShow);
                        _RecommendedShows = RecommendedShows.Except(showsToExcept);
                    }
                    else
                    {
                        // reload, none left
                        ClearProperties();
                        GUIControl.ClearControl(GetID, Facade.GetID);
                        _RecommendedShows = null;
                    }
                    LoadRecommendedShows();
                }
                break;

            case ((int)ContextMenuItem.Cast):
                GUICreditsShow.Show   = selectedShow;
                GUICreditsShow.Type   = GUICreditsShow.CreditType.Cast;
                GUICreditsShow.Fanart = TmdbCache.GetShowBackdropFilename(selectedItem.Images.ShowImages);
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsShow);
                break;

            case ((int)ContextMenuItem.Crew):
                GUICreditsShow.Show   = selectedShow;
                GUICreditsShow.Type   = GUICreditsShow.CreditType.Crew;
                GUICreditsShow.Fanart = TmdbCache.GetShowBackdropFilename(selectedItem.Images.ShowImages);
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsShow);
                break;

            case ((int)ContextMenuItem.ChangeLayout):
                CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout, PreviousSelectedIndex);
                break;

            case ((int)ContextMenuItem.SearchWithMpNZB):
                string loadingParam = string.Format("search:{0}", selectedShow.Title);
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam);
                break;

            case ((int)ContextMenuItem.SearchTorrent):
                string loadPar = selectedShow.Title;
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar);
                break;

            default:
                break;
            }

            base.OnShowContextMenu();
        }
예제 #7
0
        protected override void OnShowContextMenu()
        {
            var selectedItem = this.Facade.SelectedListItem;

            if (selectedItem == null)
            {
                return;
            }

            var selectedActivity = selectedItem.TVTag as TraktActivity.Activity;

            if (selectedActivity == null)
            {
                return;
            }

            var type = (ActivityType)Enum.Parse(typeof(ActivityType), selectedActivity.Type);

            var dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(GUIUtils.PluginName());

            GUIListItem listItem = null;

            listItem = new GUIListItem(TraktSettings.HideSpoilersOnShouts ? Translation.ShowSpoilers : Translation.HideSpoilers);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Spoilers;

            // if selected activity is an episode or show, add 'Season Info'
            if (selectedActivity.Show != null)
            {
                listItem = new GUIListItem(Translation.ShowSeasonInfo);
                dlg.Add(listItem);
                listItem.ItemId = (int)ActivityContextMenuItem.ShowSeasonInfo;
            }

            // get a list of common actions to perform on the selected item
            if (selectedActivity.Movie != null || selectedActivity.Show != null)
            {
                var listItems = GUICommon.GetContextMenuItemsForActivity();
                foreach (var item in listItems)
                {
                    int itemId = item.ItemId;
                    dlg.Add(item);
                    item.ItemId = itemId;
                }
            }

            // Show Context Menu
            dlg.DoModal(GUIWindowManager.ActiveWindow);
            if (dlg.SelectedId < 0)
            {
                return;
            }

            switch (dlg.SelectedId)
            {
            case ((int)ContextMenuItem.Spoilers):
                TraktSettings.HideSpoilersOnShouts = !TraktSettings.HideSpoilersOnShouts;
                if (hideSpoilersButton != null)
                {
                    hideSpoilersButton.Selected = TraktSettings.HideSpoilersOnShouts;
                }
                PublishShoutSkinProperties(selectedActivity);
                break;

            case ((int)ActivityContextMenuItem.ShowSeasonInfo):
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.ShowSeasons, selectedActivity.Show.ToJSON());
                break;

            case ((int)ActivityContextMenuItem.AddToList):
                if (selectedActivity.Movie != null)
                {
                    TraktHelper.AddRemoveMovieInUserList(selectedActivity.Movie, false);
                }
                else if (selectedActivity.Episode != null)
                {
                    TraktHelper.AddRemoveEpisodeInUserList(selectedActivity.Show, selectedActivity.Episode, false);
                }
                else
                {
                    TraktHelper.AddRemoveShowInUserList(selectedActivity.Show, false);
                }
                break;

            case ((int)ActivityContextMenuItem.AddToWatchList):
                if (selectedActivity.Movie != null)
                {
                    TraktHelper.AddMovieToWatchList(selectedActivity.Movie, true);
                }
                else if (selectedActivity.Episode != null)
                {
                    TraktHelper.AddEpisodeToWatchList(selectedActivity.Show, selectedActivity.Episode);
                }
                else
                {
                    TraktHelper.AddShowToWatchList(selectedActivity.Show);
                }
                break;

            case ((int)ActivityContextMenuItem.Shouts):
                if (selectedActivity.Movie != null)
                {
                    TraktHelper.ShowMovieShouts(selectedActivity.Movie);
                }
                else if (selectedActivity.Episode != null)
                {
                    TraktHelper.ShowEpisodeShouts(selectedActivity.Show, selectedActivity.Episode);
                }
                else
                {
                    TraktHelper.ShowTVShowShouts(selectedActivity.Show);
                }
                break;

            case ((int)ActivityContextMenuItem.Rate):
                if (selectedActivity.Movie != null)
                {
                    GUICommon.RateMovie(selectedActivity.Movie);
                }
                else if (selectedActivity.Episode != null)
                {
                    GUICommon.RateEpisode(selectedActivity.Show, selectedActivity.Episode);
                }
                else
                {
                    GUICommon.RateShow(selectedActivity.Show);
                }
                break;

            case ((int)ActivityContextMenuItem.Trailers):
                if (selectedActivity.Movie != null)
                {
                    GUICommon.ShowMovieTrailersMenu(selectedActivity.Movie);
                }
                else
                {
                    GUICommon.ShowTVShowTrailersMenu(selectedActivity.Show, selectedActivity.Episode);
                }
                break;
            }

            base.OnShowContextMenu();
        }
예제 #8
0
        protected override void OnShowContextMenu()
        {
            if (GUIBackgroundTask.Instance.IsBusy)
            {
                return;
            }

            var selectedItem = this.Facade.SelectedListItem as GUIShowListItem;

            if (selectedItem == null)
            {
                return;
            }

            var selectedShow = selectedItem.TVTag as TraktShowSummary;

            var dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(GUIUtils.PluginName());

            GUIListItem listItem = null;

            // Show Season Information
            listItem = new GUIListItem(Translation.ShowSeasonInfo);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.ShowSeasonInfo;

            // Mark Show As Watched
            listItem = new GUIListItem(Translation.MarkAsWatched);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.MarkAsWatched;

            // Add Show to Library
            listItem = new GUIListItem(Translation.AddToLibrary);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.AddToLibrary;

            // Add/Remove Watchlist
            if (!selectedShow.IsWatchlisted())
            {
                listItem = new GUIListItem(Translation.AddToWatchList);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.AddToWatchList;
            }
            else
            {
                listItem = new GUIListItem(Translation.RemoveFromWatchList);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList;
            }

            // Add to Custom List
            listItem = new GUIListItem(Translation.AddToList);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.AddToList;

            if (TraktHelper.IsTrailersAvailableAndEnabled)
            {
                listItem = new GUIListItem(Translation.Trailers);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.Trailers;
            }

            // Related Shows
            listItem = new GUIListItem(Translation.RelatedShows);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Related;

            // Rate Show
            listItem = new GUIListItem(Translation.RateShow);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Rate;

            // Shouts
            listItem = new GUIListItem(Translation.Comments);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Shouts;

            // Cast and Crew
            listItem = new GUIListItem(Translation.Cast);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Cast;

            listItem = new GUIListItem(Translation.Crew);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Crew;

            // Change Layout
            listItem = new GUIListItem(Translation.ChangeLayout);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.ChangeLayout;

            if (TraktHelper.IsMpNZBAvailableAndEnabled)
            {
                // Search for show with mpNZB
                listItem = new GUIListItem(Translation.SearchWithMpNZB);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB;
            }

            if (TraktHelper.IsMyTorrentsAvailableAndEnabled)
            {
                // Search for show with MyTorrents
                listItem = new GUIListItem(Translation.SearchTorrent);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.SearchTorrent;
            }

            // Show Context Menu
            dlg.DoModal(GUIWindowManager.ActiveWindow);
            if (dlg.SelectedId < 0)
            {
                return;
            }

            switch (dlg.SelectedId)
            {
            case ((int)ContextMenuItem.ShowSeasonInfo):
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.ShowSeasons, selectedShow.ToJSON());
                break;

            case ((int)ContextMenuItem.MarkAsWatched):
                GUICommon.MarkShowAsWatched(selectedShow);
                break;

            case ((int)ContextMenuItem.AddToLibrary):
                GUICommon.AddShowToCollection(selectedShow);
                break;

            case ((int)ContextMenuItem.AddToWatchList):
                TraktHelper.AddShowToWatchList(selectedShow);
                OnShowSelected(selectedItem, Facade);
                (Facade.SelectedListItem as GUIShowListItem).Images.NotifyPropertyChanged("Poster");
                break;

            case ((int)ContextMenuItem.RemoveFromWatchList):
                TraktHelper.RemoveShowFromWatchList(selectedShow);
                OnShowSelected(selectedItem, Facade);
                (Facade.SelectedListItem as GUIShowListItem).Images.NotifyPropertyChanged("Poster");
                break;

            case ((int)ContextMenuItem.AddToList):
                TraktHelper.AddRemoveShowInUserList(selectedShow, false);
                break;

            case ((int)ContextMenuItem.Trailers):
                GUICommon.ShowTVShowTrailersMenu(selectedShow);
                break;

            case ((int)ContextMenuItem.Shouts):
                TraktHelper.ShowTVShowShouts(selectedShow);
                break;

            case ((int)ContextMenuItem.Related):
                TraktHelper.ShowRelatedShows(selectedShow);
                break;

            case ((int)ContextMenuItem.Rate):
                GUICommon.RateShow(selectedShow);
                OnShowSelected(selectedItem, Facade);
                (Facade.SelectedListItem as GUIShowListItem).Images.NotifyPropertyChanged("Poster");
                break;

            case ((int)ContextMenuItem.Cast):
                GUICreditsShow.Show   = selectedShow;
                GUICreditsShow.Type   = GUICreditsShow.CreditType.Cast;
                GUICreditsShow.Fanart = TmdbCache.GetShowBackdropFilename(selectedItem.Images.ShowImages);
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsShow);
                break;

            case ((int)ContextMenuItem.Crew):
                GUICreditsShow.Show   = selectedShow;
                GUICreditsShow.Type   = GUICreditsShow.CreditType.Crew;
                GUICreditsShow.Fanart = TmdbCache.GetShowBackdropFilename(selectedItem.Images.ShowImages);
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsShow);
                break;

            case ((int)ContextMenuItem.ChangeLayout):
                CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout, PreviousSelectedIndex);
                break;

            case ((int)ContextMenuItem.SearchWithMpNZB):
                string loadingParam = string.Format("search:{0}", selectedShow.Title);
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam);
                break;

            case ((int)ContextMenuItem.SearchTorrent):
                string loadPar = selectedShow.Title;
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar);
                break;

            default:
                break;
            }

            base.OnShowContextMenu();
        }
예제 #9
0
        protected override void OnShowContextMenu()
        {
            GUIListItem selectedItem = this.Facade.SelectedListItem;

            if (selectedItem == null)
            {
                return;
            }

            TraktShow selectedShow = (TraktShow)selectedItem.TVTag;

            IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(GUIUtils.PluginName());

            GUIListItem listItem = null;

            listItem = new GUIListItem(Translation.DismissRecommendation);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.DismissRecommendation;

            // Show Season Information
            listItem = new GUIListItem(Translation.ShowSeasonInfo);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.ShowSeasonInfo;


            // Add/Remove Watch List
            if (!selectedShow.InWatchList)
            {
                listItem = new GUIListItem(Translation.AddToWatchList);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.AddToWatchList;
            }
            else
            {
                listItem = new GUIListItem(Translation.RemoveFromWatchList);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList;
            }

            listItem = new GUIListItem(Translation.AddToList + "...");
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.AddToList;

            if (TraktHelper.IsOnlineVideosAvailableAndEnabled)
            {
                listItem = new GUIListItem(Translation.Trailers);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.Trailers;
            }

            // Related Shows
            listItem = new GUIListItem(Translation.RelatedShows + "...");
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Related;

            // Rate Show
            listItem = new GUIListItem(Translation.RateShow);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Rate;

            // Shouts
            listItem = new GUIListItem(Translation.Shouts + "...");
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Shouts;

            // Change Layout
            listItem = new GUIListItem(Translation.ChangeLayout);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.ChangeLayout;

            if (TraktHelper.IsMpNZBAvailableAndEnabled)
            {
                // Search for show with mpNZB
                listItem = new GUIListItem(Translation.SearchWithMpNZB);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB;
            }

            if (TraktHelper.IsMyTorrentsAvailableAndEnabled)
            {
                // Search for show with MyTorrents
                listItem = new GUIListItem(Translation.SearchTorrent);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.SearchTorrent;
            }

            // Show Context Menu
            dlg.DoModal(GUIWindowManager.ActiveWindow);
            if (dlg.SelectedId < 0)
            {
                return;
            }

            switch (dlg.SelectedId)
            {
            case ((int)ContextMenuItem.DismissRecommendation):
                PreviousSelectedIndex = this.Facade.SelectedListItemIndex;
                DismissRecommendation(selectedShow);
                if (_RecommendedShows.Count() > 1)
                {
                    var showsToExcept = new List <TraktShow>();
                    showsToExcept.Add(selectedShow);
                    _RecommendedShows = RecommendedShows.Except(showsToExcept);
                }
                else
                {
                    // reload, none left
                    ClearProperties();
                    GUIControl.ClearControl(GetID, Facade.GetID);
                    _RecommendedShows = null;
                }
                LoadRecommendedShows();
                break;

            case ((int)ContextMenuItem.ShowSeasonInfo):
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.ShowSeasons, selectedShow.ToJSON());
                break;

            case ((int)ContextMenuItem.AddToWatchList):
                AddShowToWatchList(selectedShow);
                selectedShow.InWatchList = true;
                OnShowSelected(selectedItem, Facade);
                selectedShow.Images.NotifyPropertyChanged("PosterImageFilename");
                GUIWatchListShows.ClearCache(TraktSettings.Username);
                break;

            case ((int)ContextMenuItem.RemoveFromWatchList):
                RemoveShowFromWatchList(selectedShow);
                selectedShow.InWatchList = false;
                OnShowSelected(selectedItem, Facade);
                selectedShow.Images.NotifyPropertyChanged("PosterImageFilename");
                GUIWatchListShows.ClearCache(TraktSettings.Username);
                break;

            case ((int)ContextMenuItem.AddToList):
                TraktHelper.AddRemoveShowInUserList(selectedShow.Title, selectedShow.Year.ToString(), selectedShow.Tvdb, false);
                break;

            case ((int)ContextMenuItem.Related):
                RelatedShow relatedShow = new RelatedShow();
                relatedShow.Title           = selectedShow.Title;
                relatedShow.TVDbId          = selectedShow.Tvdb;
                GUIRelatedShows.relatedShow = relatedShow;
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.RelatedShows);
                break;

            case ((int)ContextMenuItem.Trailers):
                GUICommon.ShowTVShowTrailersMenu(selectedShow);
                break;

            case ((int)ContextMenuItem.Shouts):
                GUIShouts.ShoutType = GUIShouts.ShoutTypeEnum.show;
                GUIShouts.ShowInfo  = new ShowShout {
                    IMDbId = selectedShow.Imdb, TVDbId = selectedShow.Tvdb, Title = selectedShow.Title
                };
                GUIShouts.Fanart = selectedShow.Images.FanartImageFilename;
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.Shouts);
                break;

            case ((int)ContextMenuItem.Rate):
                PreviousSelectedIndex = this.Facade.SelectedListItemIndex;
                if (GUICommon.RateShow(selectedShow))
                {
                    // remove from recommendations
                    if (_RecommendedShows.Count() > 1)
                    {
                        var showsToExcept = new List <TraktShow>();
                        showsToExcept.Add(selectedShow);
                        _RecommendedShows = RecommendedShows.Except(showsToExcept);
                    }
                    else
                    {
                        // reload, none left
                        ClearProperties();
                        GUIControl.ClearControl(GetID, Facade.GetID);
                        _RecommendedShows = null;
                    }
                    LoadRecommendedShows();
                }
                break;

            case ((int)ContextMenuItem.ChangeLayout):
                CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout);
                break;

            case ((int)ContextMenuItem.SearchWithMpNZB):
                string loadingParam = string.Format("search:{0}", selectedShow.Title);
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam);
                break;

            case ((int)ContextMenuItem.SearchTorrent):
                string loadPar = selectedShow.Title;
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar);
                break;

            default:
                break;
            }

            base.OnShowContextMenu();
        }
예제 #10
0
        protected override void OnShowContextMenu()
        {
            GUIListItem selectedItem = this.Facade.SelectedListItem;

            if (selectedItem == null)
            {
                return;
            }

            TraktTrendingShow selectedShow = (TraktTrendingShow)selectedItem.TVTag;

            IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(GUIUtils.PluginName());

            GUICommon.CreateTrendingShowsContextMenu(ref dlg, selectedShow, false);

            // Show Context Menu
            dlg.DoModal(GUIWindowManager.ActiveWindow);
            if (dlg.SelectedId < 0)
            {
                return;
            }

            switch (dlg.SelectedId)
            {
            case ((int)TrendingContextMenuItem.AddToWatchList):
                TraktHelper.AddShowToWatchList(selectedShow);
                selectedShow.InWatchList = true;
                OnShowSelected(selectedItem, Facade);
                selectedShow.Images.NotifyPropertyChanged("PosterImageFilename");
                if (TraktSettings.TrendingShowsHideWatchlisted)
                {
                    LoadTrendingShows();
                }
                break;

            case ((int)TrendingContextMenuItem.ShowSeasonInfo):
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.ShowSeasons, selectedShow.ToJSON());
                break;

            case ((int)TrendingContextMenuItem.MarkAsWatched):
                GUICommon.MarkShowAsSeen(selectedShow);
                if (TraktSettings.TrendingShowsHideWatched)
                {
                    LoadTrendingShows();
                }
                break;

            case ((int)TrendingContextMenuItem.AddToLibrary):
                GUICommon.AddShowToLibrary(selectedShow);
                if (TraktSettings.TrendingShowsHideCollected)
                {
                    LoadTrendingShows();
                }
                break;

            case ((int)TrendingContextMenuItem.RemoveFromWatchList):
                TraktHelper.RemoveShowFromWatchList(selectedShow);
                selectedShow.InWatchList = false;
                OnShowSelected(selectedItem, Facade);
                selectedShow.Images.NotifyPropertyChanged("PosterImageFilename");
                break;

            case ((int)TrendingContextMenuItem.AddToList):
                TraktHelper.AddRemoveShowInUserList(selectedShow.Title, selectedShow.Year.ToString(), selectedShow.Tvdb, false);
                break;

            case ((int)TrendingContextMenuItem.Filters):
                if (GUICommon.ShowTVShowFiltersMenu())
                {
                    UpdateButtonState();
                    LoadTrendingShows();
                }
                break;

            case ((int)TrendingContextMenuItem.Related):
                TraktHelper.ShowRelatedShows(selectedShow);
                break;

            case ((int)TrendingContextMenuItem.Trailers):
                GUICommon.ShowTVShowTrailersMenu(selectedShow);
                break;

            case ((int)TrendingContextMenuItem.Shouts):
                TraktHelper.ShowTVShowShouts(selectedShow);
                break;

            case ((int)TrendingContextMenuItem.Rate):
                GUICommon.RateShow(selectedShow);
                OnShowSelected(selectedItem, Facade);
                selectedShow.Images.NotifyPropertyChanged("PosterImageFilename");
                if (TraktSettings.TrendingShowsHideRated)
                {
                    LoadTrendingShows();
                }
                break;

            case ((int)TrendingContextMenuItem.ChangeLayout):
                CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout);
                break;

            case ((int)TrendingContextMenuItem.SearchWithMpNZB):
                string loadingParam = string.Format("search:{0}", selectedShow.Title);
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam);
                break;

            case ((int)TrendingContextMenuItem.SearchTorrent):
                string loadPar = selectedShow.Title;
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar);
                break;

            default:
                break;
            }

            base.OnShowContextMenu();
        }