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();
}