protected override void OnShowContextMenu() { var dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(GUIUtils.PluginName()); var selectedItem = Facade.SelectedListItem as GUIMovieListItem; if (selectedItem == null) { return; } var calendarItem = selectedItem.TVTag as TraktMovieCalendar; if (calendarItem == null) { return; } // Create Views Menu Item var listItem = new GUIListItem(Translation.ChangeView); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.View; // Start Date listItem = new GUIListItem(Translation.StartDate + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.StartDate; // Max Days listItem = new GUIListItem(Translation.MaxDays + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MaxDays; // Hide Movie listItem = new GUIListItem(Translation.HideMovie); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.HideMovie; // Related Movies listItem = new GUIListItem(Translation.RelatedMovies); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Related; // Rate listItem = new GUIListItem(Translation.Rate + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Rate; // Mark As Watched if (!calendarItem.Movie.IsWatched()) { listItem = new GUIListItem(Translation.MarkAsWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsWatched; } else { listItem = new GUIListItem(Translation.MarkAsUnWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsUnWatched; } // Add/Remove Movie Watchlist if (!calendarItem.Movie.IsWatchlisted()) { listItem = new GUIListItem(Translation.AddToWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddMovieToWatchlist; } else { listItem = new GUIListItem(Translation.RemoveFromWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveMovieFromWatchlist; } // Add Movie to Custom List listItem = new GUIListItem(Translation.AddToList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddMovieToList; // Shouts listItem = new GUIListItem(Translation.Comments); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Shouts; // Add/Remove Libary if (!calendarItem.Movie.IsCollected()) { listItem = new GUIListItem(Translation.AddToLibrary); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToLibrary; } else { listItem = new GUIListItem(Translation.RemoveFromLibrary); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromLibrary; } // Cast and Crew listItem = new GUIListItem(Translation.Cast); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Cast; listItem = new GUIListItem(Translation.Crew); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Crew; if (TraktHelper.IsTrailersAvailableAndEnabled) { listItem = new GUIListItem(Translation.Trailers); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Trailers; } // Show Context Menu dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId < 0) { return; } switch (dlg.SelectedId) { case ((int)ContextMenuItem.View): ShowViewMenu(); break; case ((int)ContextMenuItem.StartDate): ShowStartDateMenu(); break; case ((int)ContextMenuItem.MaxDays): ShowMaxDaysMenu(); break; case ((int)ContextMenuItem.HideMovie): TraktHelper.AddHiddenMovie(calendarItem.Movie, "calendar"); FilterHiddenMovies = true; LoadCalendar(); break; case ((int)ContextMenuItem.Related): TraktHelper.ShowRelatedMovies(calendarItem.Movie); break; case ((int)ContextMenuItem.Shouts): TraktHelper.ShowMovieShouts(calendarItem.Movie); break; case ((int)ContextMenuItem.Rate): GUICommon.RateMovie(calendarItem.Movie); OnMovieSelected(Facade.SelectedListItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.MarkAsWatched): TraktHelper.AddMovieToWatchHistory(calendarItem.Movie); Facade.SelectedListItem.IsPlayed = true; OnMovieSelected(Facade.SelectedListItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.MarkAsUnWatched): TraktHelper.RemoveMovieFromWatchHistory(calendarItem.Movie); Facade.SelectedListItem.IsPlayed = false; OnMovieSelected(Facade.SelectedListItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.AddMovieToWatchlist): TraktHelper.AddMovieToWatchList(calendarItem.Movie, true); OnMovieSelected(Facade.SelectedListItem, Facade); GUIWatchListMovies.ClearCache(TraktSettings.Username); break; case ((int)ContextMenuItem.RemoveMovieFromWatchlist): TraktHelper.RemoveMovieFromWatchList(calendarItem.Movie, true); OnMovieSelected(Facade.SelectedListItem, Facade); GUIWatchListMovies.ClearCache(TraktSettings.Username); break; case ((int)ContextMenuItem.AddMovieToList): TraktHelper.AddRemoveMovieInUserList(calendarItem.Movie, false); break; case ((int)ContextMenuItem.AddToLibrary): TraktHelper.AddMovieToCollection(calendarItem.Movie); OnMovieSelected(Facade.SelectedListItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.RemoveFromLibrary): TraktHelper.RemoveMovieFromCollection(calendarItem.Movie); OnMovieSelected(Facade.SelectedListItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.Cast): GUICreditsMovie.Movie = calendarItem.Movie; GUICreditsMovie.Type = GUICreditsMovie.CreditType.Cast; GUICreditsMovie.Fanart = TmdbCache.GetMovieBackdropFilename(selectedItem.Images.MovieImages); GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsMovie); break; case ((int)ContextMenuItem.Crew): GUICreditsMovie.Movie = calendarItem.Movie; GUICreditsMovie.Type = GUICreditsMovie.CreditType.Crew; GUICreditsMovie.Fanart = TmdbCache.GetMovieBackdropFilename(selectedItem.Images.MovieImages); GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsMovie); break; case ((int)ContextMenuItem.Trailers): if (calendarItem != null) { GUICommon.ShowMovieTrailersMenu(calendarItem.Movie); } break; default: break; } base.OnShowContextMenu(); }