protected override void OnShowContextMenu() { var selectedItem = this.Facade.SelectedListItem; if (selectedItem == null) { return; } var selectedSeason = selectedItem.TVTag as TraktSeasonSummary; var dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(GUIUtils.PluginName()); GUIListItem listItem = null; // Trailers if (TraktHelper.IsTrailersAvailableAndEnabled) { listItem = new GUIListItem(Translation.Trailers); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Trailers; } // Comments listItem = new GUIListItem(Translation.Comments); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Comments; // Rate listItem = new GUIListItem(Translation.Rate + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Rate; // Mark season as watched listItem = new GUIListItem(Translation.MarkAsWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsWatched; // Add season to Library listItem = new GUIListItem(Translation.AddToLibrary); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToLibrary; // Add to Custom List listItem = new GUIListItem(Translation.AddToList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToList; // Add to Watchlist listItem = new GUIListItem(Translation.AddToWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToWatchlist; // Sort By listItem = new GUIListItem(TraktSettings.SortSeasonsAscending ? Translation.SortSeasonsDescending : Translation.SortSeasonsAscending); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Sort; // Change Layout listItem = new GUIListItem(Translation.ChangeLayout); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.ChangeLayout; // Show Context Menu dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId < 0) { return; } switch (dlg.SelectedId) { case ((int)ContextMenuItem.Trailers): GUICommon.ShowTVSeasonTrailersPluginMenu(Show, selectedSeason.Number); break; case ((int)ContextMenuItem.Comments): TraktHelper.ShowTVSeasonShouts(Show, selectedSeason); break; case ((int)ContextMenuItem.Rate): GUICommon.RateSeason(Show, selectedSeason); OnSeasonSelected(selectedItem, Facade); (Facade.SelectedListItem as GUISeasonListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.MarkAsWatched): GUICommon.MarkSeasonAsWatched(Show, selectedSeason.Number); OnSeasonSelected(selectedItem, Facade); (Facade.SelectedListItem as GUISeasonListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.AddToLibrary): GUICommon.AddSeasonToLibrary(Show, selectedSeason.Number); OnSeasonSelected(selectedItem, Facade); (Facade.SelectedListItem as GUISeasonListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.AddToList): TraktHelper.AddRemoveSeasonInUserList(selectedSeason, false); break; case ((int)ContextMenuItem.AddToWatchlist): TraktHelper.AddSeasonToWatchList(Show, selectedSeason.Number); OnSeasonSelected(selectedItem, Facade); (Facade.SelectedListItem as GUISeasonListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.Sort): TraktSettings.SortSeasonsAscending = !TraktSettings.SortSeasonsAscending; LoadShowSeasons(); break; case ((int)ContextMenuItem.ChangeLayout): CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout, PreviousSelectedIndex); break; default: break; } base.OnShowContextMenu(); }