protected override void OnShowContextMenu() { var selectedItem = this.Facade.SelectedListItem; if (selectedItem == null) { return; } var selectedMovie = selectedItem.TVTag as TraktTrendingMovie; if (selectedMovie == null) { return; } var dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(GUIUtils.PluginName()); GUICommon.CreateTrendingMoviesContextMenu(ref dlg, selectedMovie, false); // Show Context Menu dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId < 0) { return; } switch (dlg.SelectedId) { case ((int)TrendingContextMenuItem.MarkAsWatched): TraktHelper.MarkMovieAsWatched(selectedMovie); if (selectedMovie.Plays == 0) { selectedMovie.Plays = 1; } selectedMovie.Watched = true; selectedItem.IsPlayed = true; OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); if (TraktSettings.TrendingMoviesHideWatched) { LoadTrendingMovies(); } break; case ((int)TrendingContextMenuItem.MarkAsUnWatched): TraktHelper.MarkMovieAsUnWatched(selectedMovie); selectedMovie.Watched = false; selectedItem.IsPlayed = false; OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)TrendingContextMenuItem.AddToWatchList): TraktHelper.AddMovieToWatchList(selectedMovie, true); selectedMovie.InWatchList = true; OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); if (TraktSettings.TrendingMoviesHideWatchlisted) { LoadTrendingMovies(); } break; case ((int)TrendingContextMenuItem.RemoveFromWatchList): TraktHelper.RemoveMovieFromWatchList(selectedMovie, true); selectedMovie.InWatchList = false; OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)TrendingContextMenuItem.AddToList): TraktHelper.AddRemoveMovieInUserList(selectedMovie, false); break; case ((int)TrendingContextMenuItem.AddToLibrary): TraktHelper.AddMovieToLibrary(selectedMovie); selectedMovie.InCollection = true; OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); if (TraktSettings.TrendingMoviesHideCollected) { LoadTrendingMovies(); } break; case ((int)TrendingContextMenuItem.RemoveFromLibrary): TraktHelper.RemoveMovieFromLibrary(selectedMovie); selectedMovie.InCollection = false; OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)TrendingContextMenuItem.Related): TraktHelper.ShowRelatedMovies(selectedMovie); break; case ((int)TrendingContextMenuItem.Rate): GUICommon.RateMovie(selectedMovie); OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); if (TraktSettings.TrendingMoviesHideRated) { LoadTrendingMovies(); } break; case ((int)TrendingContextMenuItem.Filters): if (GUICommon.ShowMovieFiltersMenu()) { UpdateButtonState(); LoadTrendingMovies(); } break; case ((int)TrendingContextMenuItem.Shouts): TraktHelper.ShowMovieShouts(selectedMovie); break; case ((int)TrendingContextMenuItem.Trailers): GUICommon.ShowMovieTrailersMenu(selectedMovie); break; case ((int)TrendingContextMenuItem.ChangeLayout): CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout, PreviousSelectedIndex); break; case ((int)TrendingContextMenuItem.SearchWithMpNZB): string loadingParam = string.Format("search:{0}", selectedMovie.Title); GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam); break; case ((int)TrendingContextMenuItem.SearchTorrent): string loadPar = selectedMovie.Title; GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar); break; default: break; } base.OnShowContextMenu(); }