protected override void OnShowContextMenu() { var selectedItem = this.Facade.SelectedListItem as GUIMovieListItem; if (selectedItem == null) { return; } var selectedPopularMovie = selectedItem.TVTag as TraktMovieSummary; if (selectedPopularMovie == null) { return; } var dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(GUIUtils.PluginName()); GUICommon.CreateMoviesContextMenu(ref dlg, selectedPopularMovie, false); // Show Context Menu dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId < 0) { return; } switch (dlg.SelectedId) { case ((int)MediaContextMenuItem.MarkAsWatched): TraktHelper.AddMovieToWatchHistory(selectedPopularMovie); selectedItem.IsPlayed = true; OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); if (TraktSettings.PopularMoviesHideWatched) { LoadPopularMovies(CurrentPage); } break; case ((int)MediaContextMenuItem.MarkAsUnWatched): TraktHelper.RemoveMovieFromWatchHistory(selectedPopularMovie); selectedItem.IsPlayed = false; OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)MediaContextMenuItem.AddToWatchList): TraktHelper.AddMovieToWatchList(selectedPopularMovie, true); OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); if (TraktSettings.PopularMoviesHideWatchlisted) { LoadPopularMovies(CurrentPage); } break; case ((int)MediaContextMenuItem.RemoveFromWatchList): TraktHelper.RemoveMovieFromWatchList(selectedPopularMovie, true); OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)MediaContextMenuItem.AddToList): TraktHelper.AddRemoveMovieInUserList(selectedPopularMovie, false); break; case ((int)MediaContextMenuItem.AddToLibrary): TraktHelper.AddMovieToCollection(selectedPopularMovie); OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); if (TraktSettings.PopularMoviesHideCollected) { LoadPopularMovies(CurrentPage); } break; case ((int)MediaContextMenuItem.RemoveFromLibrary): TraktHelper.RemoveMovieFromCollection(selectedPopularMovie); OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)MediaContextMenuItem.Related): TraktHelper.ShowRelatedMovies(selectedPopularMovie); break; case ((int)MediaContextMenuItem.Rate): GUICommon.RateMovie(selectedPopularMovie); OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); if (TraktSettings.PopularMoviesHideRated) { LoadPopularMovies(CurrentPage); } break; case ((int)MediaContextMenuItem.Filters): if (ShowMovieFiltersMenu()) { PreviousSelectedIndex = CurrentPage == 1 ? 0 : 1; UpdateButtonState(); LoadPopularMovies(CurrentPage); } break; case ((int)MediaContextMenuItem.Shouts): TraktHelper.ShowMovieShouts(selectedPopularMovie); break; case ((int)MediaContextMenuItem.Cast): GUICreditsMovie.Movie = selectedPopularMovie; GUICreditsMovie.Type = GUICreditsMovie.CreditType.Cast; GUICreditsMovie.Fanart = TmdbCache.GetMovieBackdropFilename(selectedItem.Images.MovieImages); GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsMovie); break; case ((int)MediaContextMenuItem.Crew): GUICreditsMovie.Movie = selectedPopularMovie; GUICreditsMovie.Type = GUICreditsMovie.CreditType.Crew; GUICreditsMovie.Fanart = TmdbCache.GetMovieBackdropFilename(selectedItem.Images.MovieImages); GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsMovie); break; case ((int)MediaContextMenuItem.Trailers): GUICommon.ShowMovieTrailersMenu(selectedPopularMovie); break; case ((int)MediaContextMenuItem.ChangeLayout): CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout, PreviousSelectedIndex); break; case ((int)MediaContextMenuItem.SearchWithMpNZB): string loadingParam = string.Format("search:{0}", selectedPopularMovie.Title); GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam); break; case ((int)MediaContextMenuItem.SearchTorrent): string loadParm = selectedPopularMovie.Title; GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadParm); break; default: break; } base.OnShowContextMenu(); }