protected override void OnShowContextMenu() { GUIListItem selectedItem = this.Facade.SelectedListItem; if (selectedItem == null) { return; } TraktShowSeason selectedSeason = (TraktShowSeason)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; // 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; // 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.MarkAsWatched): GUICommon.MarkSeasonAsSeen(Show, selectedSeason.Season); break; case ((int)ContextMenuItem.AddToLibrary): GUICommon.AddSeasonToLibrary(Show, selectedSeason.Season); break; case ((int)ContextMenuItem.AddToList): TraktHelper.AddRemoveSeasonInUserList(Show.Title, Show.Year.ToString(), selectedSeason.Season.ToString(), Show.Tvdb, false); break; case ((int)ContextMenuItem.Sort): TraktSettings.SortSeasonsAscending = !TraktSettings.SortSeasonsAscending; LoadShowSeasons(); break; case ((int)ContextMenuItem.ChangeLayout): CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout); break; default: break; } base.OnShowContextMenu(); }