private void ShowRecentSearches() { if (MainWindow.downloadSearchHistory.Count == 0) { Utils.DialogMsg("Error", "No history found"); return; } else { IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); dlg.Reset(); dlg.SetHeading("Search History"); GUIListItem pItem = null; for (int i = MainWindow.downloadSearchHistory.Count - 1; i >= 0; i--) { pItem = new GUIListItem(MainWindow.downloadSearchHistory[i].ToString()); dlg.Add(pItem); } dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedLabel >= 0) { int idx = MainWindow.downloadSearchHistory.Count - dlg.SelectedLabel - 1; ShowSearchResults(MainWindow.downloadSearchHistory[idx], MainWindow.downloadSearchResultsHistory[idx]); } } }
private void ShowLayoutsMenu() { IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); dlg.Reset(); dlg.SetHeading(GetLayoutTranslation(CurrentLayout)); foreach (Layout layout in Enum.GetValues(typeof(Layout))) { string menuItem = GetLayoutTranslation(layout); GUIListItem pItem = new GUIListItem(menuItem); if (layout == CurrentLayout) { pItem.Selected = true; } dlg.Add(pItem); } dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedLabel >= 0) { CurrentLayout = (Layout)dlg.SelectedLabel; FacadeActors.CurrentLayout = (GUIFacadeControl.Layout)CurrentLayout; GUIControl.SetControlLabel(GetID, ButtonLayouts.GetID, GetLayoutTranslation(CurrentLayout)); } }
private void ShowGenreMenu() { IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); dlg.Reset(); dlg.SetHeading(TraktGenres.ItemName(CurrentGenre)); foreach (string genre in TraktGenres.ShowGenres.Keys) { string menuItem = TraktGenres.ItemName(genre); GUIListItem pItem = new GUIListItem(menuItem); if (genre == CurrentGenre) { pItem.Selected = true; } dlg.Add(pItem); } dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedLabel >= 0) { var genre = TraktGenres.ShowGenres.ElementAt(dlg.SelectedLabel).Key; if (genre != CurrentGenre) { CurrentGenre = genre; GUIControl.SetControlLabel(GetID, genreButton.GetID, TraktGenres.ItemName(CurrentGenre)); ReloadRecommendations(); } } }
private void DoContextMenu() { IDialogbox dialog = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dialog == null) { return; } dialog.Reset(); dialog.SetHeading(924); // menu //foreach (object item in ContextMenu.Items) //{ // if (item is MenuItem) // { // dialog.Add(((MenuItem)item).Header as string); // } //} dialog.DoModal(ParentID); if (dialog.SelectedId == -1) { return; } }
private void DoContextMenu() { IDialogbox dialog = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dialog == null) { return; } dialog.Reset(); dialog.SetHeading(924); // menu dialog.DoModal(ParentID); }
private void ShowViewMenu() { IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(Translation.Calendar); foreach (int value in Enum.GetValues(typeof(CalendarType))) { CalendarType type = (CalendarType)Enum.Parse(typeof(CalendarType), value.ToString()); string label = GetCalendarTypeName(type); // Create new item GUIListItem listItem = new GUIListItem(label); listItem.ItemId = value; // Set selected if current if (type == CurrentCalendar) { listItem.Selected = true; } // Add new item to context menu dlg.Add(listItem); } dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId <= 0) { return; } // Set new Selection CurrentCalendar = (CalendarType)Enum.GetValues(typeof(CalendarType)).GetValue(dlg.SelectedLabel); SetCurrentView(); // Reset Views and Apply CurrentWeekDays = 7; PreviousSelectedIndex = 0; PreviousCalendarDayCount = 0; _CalendarMyShows = null; _CalendarPremieres = null; _CalendarAllShows = null; LoadCalendar(); }
private void ShowViewMenu() { IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(Translation.View); foreach (int value in Enum.GetValues(typeof(View))) { View type = (View)Enum.Parse(typeof(View), value.ToString()); string label = GetViewTypeName(type); // Create new item GUIListItem listItem = new GUIListItem(label); listItem.ItemId = value; // Set selected if current if (type == CurrentView) { listItem.Selected = true; } // Add new item to context menu dlg.Add(listItem); } dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId <= 0) { return; } // Set new Selection CurrentView = (View)Enum.GetValues(typeof(View)).GetValue(dlg.SelectedLabel); SetCurrentView(); // Reset Views and Apply PreviousUserSelectedIndex = 0; PreviousActivityTypeSelectedIndex = 0; // reset view level re-load view CurrentViewLevel = ViewLevel.Network; LoadView(); }
private bool DisplayGlobalActionsMenu() { if (ActiveListControl == null) { return(false); } IDialogbox dialog = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); dialog.Reset(); dialog.SetHeading("Moving Pictures"); // not translated because it's a proper noun GUIListItem rescanItem = new GUIListItem(Translation.ScanForNewMovies); GUIListItem unignoreItem = new GUIListItem(Translation.RestoreIgnoredFiles); int currID = 1; rescanItem.ItemId = currID++; dialog.Add(rescanItem); unignoreItem.ItemId = currID++; dialog.Add(unignoreItem); dialog.DoModal(GUIWindowManager.ActiveWindow); if (dialog.SelectedId == -1) { return(false); } else if (dialog.SelectedId == rescanItem.ItemId) { MovingPicturesCore.Importer.RestartScanner(); } else if (dialog.SelectedId == unignoreItem.ItemId) { MovingPicturesCore.Importer.RestoreAllIgnoredFiles(); } return(true); }
/// <summary> /// Show a station picker /// </summary> /// <returns>Station chosen by the user, or null if the user canceled out of the menu</returns> private PandoraStation ShowStationChooser() { IDialogbox dialog = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); dialog.Reset(); dialog.SetHeading("Choose Station"); int index = 0; Dictionary <int, PandoraStation> stationLookup = new Dictionary <int, PandoraStation>(); foreach (PandoraStation currStation in Core.MusicBox.AvailableStations) { if (currStation.IsQuickMix) { continue; } index++; stationLookup[index] = currStation; } foreach (var station in stationLookup) { GUIListItem listItem = new GUIListItem(station.Value.Name); listItem.ItemId = station.Key; if (station.Value == Core.MusicBox.CurrentStation) { listItem.Selected = true; } dialog.Add(listItem); } dialog.DoModal(GUIWindowManager.ActiveWindow); if (dialog.SelectedId < 0) { return(null); // user canceled out of menu } return(stationLookup[dialog.SelectedId]); }
private void ShowMainContext() { IDialogbox dialog = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); dialog.Reset(); dialog.SetHeading("Pandora MusicBox"); GUIListItem stationsItem = new GUIListItem("Switch Stations..."); dialog.Add(stationsItem); GUIListItem newStationItem = new GUIListItem("Create a New Station..."); dialog.Add(newStationItem); GUIListItem showSongMenuItem = new GUIListItem("Song Options..."); dialog.Add(showSongMenuItem); dialog.DoModal(GUIWindowManager.ActiveWindow); if (dialog.SelectedId == stationsItem.ItemId) { PromptAndChangeStation(); } else if (dialog.SelectedId == newStationItem.ItemId) { // todo: onscreen keyboard to create a new station } else if (dialog.SelectedId == showSongMenuItem.ItemId) { ShowSongContext(Core.MusicBox.CurrentSong); } }
protected override void OnShowContextMenu() { if (GUIBackgroundTask.Instance.IsBusy) { return; } GUIListItem selectedItem = this.Facade.SelectedListItem; if (selectedItem == null) { return; } TraktShow selectedShow = (TraktShow)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; // Show Season Information listItem = new GUIListItem(Translation.ShowSeasonInfo); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.ShowSeasonInfo; // Hide/Show Watched items listItem = new GUIListItem(HideWatched ? Translation.ShowWatched : Translation.HideWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.HideShowWatched; // Mark Show As Watched listItem = new GUIListItem(Translation.MarkAsWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsWatched; // Add Show to Library listItem = new GUIListItem(Translation.AddToLibrary); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToLibrary; // Add/Remove Watch List if (!selectedShow.InWatchList) { listItem = new GUIListItem(Translation.AddToWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToWatchList; } else { listItem = new GUIListItem(Translation.RemoveFromWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList; } // Add to Custom List listItem = new GUIListItem(Translation.AddToList + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToList; if (TraktHelper.IsOnlineVideosAvailableAndEnabled) { listItem = new GUIListItem(Translation.Trailers); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Trailers; } // Related Shows listItem = new GUIListItem(Translation.RelatedShows + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Related; // Rate Show listItem = new GUIListItem(Translation.RateShow); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Rate; // Shouts listItem = new GUIListItem(Translation.Shouts + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Shouts; // Change Layout listItem = new GUIListItem(Translation.ChangeLayout); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.ChangeLayout; if (TraktHelper.IsMpNZBAvailableAndEnabled) { // Search for show with mpNZB listItem = new GUIListItem(Translation.SearchWithMpNZB); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB; } if (TraktHelper.IsMyTorrentsAvailableAndEnabled) { // Search for show with MyTorrents listItem = new GUIListItem(Translation.SearchTorrent); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchTorrent; } // Show Context Menu dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId < 0) { return; } switch (dlg.SelectedId) { case ((int)ContextMenuItem.ShowSeasonInfo): GUIWindowManager.ActivateWindow((int)TraktGUIWindows.ShowSeasons, selectedShow.ToJSON()); break; case ((int)ContextMenuItem.HideShowWatched): HideWatched = !HideWatched; if (hideWatchedButton != null) { hideWatchedButton.Selected = HideWatched; } dictRelatedShows.Remove(relatedShow.Slug); LoadRelatedShows(); break; case ((int)ContextMenuItem.MarkAsWatched): GUICommon.MarkShowAsSeen(selectedShow); break; case ((int)ContextMenuItem.AddToLibrary): GUICommon.AddShowToLibrary(selectedShow); break; case ((int)ContextMenuItem.AddToWatchList): AddShowToWatchList(selectedShow); selectedShow.InWatchList = true; OnShowSelected(selectedItem, Facade); selectedShow.Images.NotifyPropertyChanged("PosterImageFilename"); GUIWatchListShows.ClearCache(TraktSettings.Username); break; case ((int)ContextMenuItem.RemoveFromWatchList): RemoveShowFromWatchList(selectedShow); selectedShow.InWatchList = false; OnShowSelected(selectedItem, Facade); selectedShow.Images.NotifyPropertyChanged("PosterImageFilename"); GUIWatchListShows.ClearCache(TraktSettings.Username); break; case ((int)ContextMenuItem.AddToList): TraktHelper.AddRemoveShowInUserList(selectedShow.Title, selectedShow.Year.ToString(), selectedShow.Tvdb, false); break; case ((int)ContextMenuItem.Trailers): GUICommon.ShowTVShowTrailersMenu(selectedShow); break; case ((int)ContextMenuItem.Shouts): GUIShouts.ShoutType = GUIShouts.ShoutTypeEnum.show; GUIShouts.ShowInfo = new ShowShout { IMDbId = selectedShow.Imdb, TVDbId = selectedShow.Tvdb, Title = selectedShow.Title }; GUIShouts.Fanart = selectedShow.Images.FanartImageFilename; GUIWindowManager.ActivateWindow((int)TraktGUIWindows.Shouts); break; case ((int)ContextMenuItem.Related): RelatedShow relShow = new RelatedShow { Title = selectedShow.Title, TVDbId = selectedShow.Tvdb }; relatedShow = relShow; LoadRelatedShows(); GUIUtils.SetProperty("#Trakt.Related.Show", relatedShow.Title); RelationChanged = true; break; case ((int)ContextMenuItem.Rate): GUICommon.RateShow(selectedShow); OnShowSelected(selectedItem, Facade); selectedShow.Images.NotifyPropertyChanged("PosterImageFilename"); break; case ((int)ContextMenuItem.ChangeLayout): CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout); break; case ((int)ContextMenuItem.SearchWithMpNZB): string loadingParam = string.Format("search:{0}", selectedShow.Title); GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam); break; case ((int)ContextMenuItem.SearchTorrent): string loadPar = selectedShow.Title; GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar); break; default: break; } base.OnShowContextMenu(); }
protected override void OnShowContextMenu() { GUIListItem selectedItem = this.Facade.SelectedListItem; if (selectedItem == null) { return; } var selectedEpisodeSummary = selectedItem.TVTag as TraktEpisodeSummary; if (selectedEpisodeSummary == null) { return; } var selectedEpisode = selectedEpisodeSummary.Episode; if (selectedEpisode == null) { return; } var selectedShow = selectedEpisodeSummary.Show; if (selectedShow == null) { return; } IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(GUIUtils.PluginName()); GUIListItem listItem = null; // Show Season Information listItem = new GUIListItem(Translation.ShowSeasonInfo); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.ShowSeasonInfo; if (!selectedEpisode.InWatchList) { listItem = new GUIListItem(Translation.AddToWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToWatchList; } else { listItem = new GUIListItem(Translation.RemoveFromWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList; } // Add to Custom List listItem = new GUIListItem(Translation.AddToList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToList; // Mark As Watched if (!selectedEpisode.Watched) { listItem = new GUIListItem(Translation.MarkAsWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsWatched; } // Mark As UnWatched if (selectedEpisode.Watched) { listItem = new GUIListItem(Translation.MarkAsUnWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsUnWatched; } // Add to Library // Don't allow if it will be removed again on next sync // movie could be part of a DVD collection if (!selectedEpisode.InCollection && !TraktSettings.KeepTraktLibraryClean) { listItem = new GUIListItem(Translation.AddToLibrary); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToLibrary; } if (selectedEpisode.InCollection) { listItem = new GUIListItem(Translation.RemoveFromLibrary); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromLibrary; } // Related Shows listItem = new GUIListItem(Translation.RelatedShows + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Related; // Rate Episode listItem = new GUIListItem(Translation.RateEpisode); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Rate; // Shouts listItem = new GUIListItem(Translation.Shouts + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Shouts; if (TraktHelper.IsOnlineVideosAvailableAndEnabled) { // Trailers listItem = new GUIListItem(Translation.Trailers); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Trailers; } // Change Layout listItem = new GUIListItem(Translation.ChangeLayout); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.ChangeLayout; if (!selectedEpisode.InCollection && TraktHelper.IsMpNZBAvailableAndEnabled) { // Search for movie with mpNZB listItem = new GUIListItem(Translation.SearchWithMpNZB); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB; } if (!selectedEpisode.InCollection && TraktHelper.IsMyTorrentsAvailableAndEnabled) { // Search for movie with MyTorrents listItem = new GUIListItem(Translation.SearchTorrent); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchTorrent; } // Show Context Menu dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId < 0) { return; } switch (dlg.SelectedId) { case ((int)ContextMenuItem.ShowSeasonInfo): GUIWindowManager.ActivateWindow((int)TraktGUIWindows.ShowSeasons, selectedShow.ToJSON()); break; case ((int)ContextMenuItem.MarkAsWatched): TraktHelper.MarkEpisodeAsWatched(selectedShow, selectedEpisode); if (selectedEpisode.Plays == 0) { selectedEpisode.Plays = 1; } selectedEpisode.Watched = true; selectedItem.IsPlayed = true; OnEpisodeSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIEpisodeListItem).Images.NotifyPropertyChanged("Screen"); break; case ((int)ContextMenuItem.MarkAsUnWatched): TraktHelper.MarkEpisodeAsUnWatched(selectedShow, selectedEpisode); selectedEpisode.Watched = false; selectedItem.IsPlayed = false; OnEpisodeSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIEpisodeListItem).Images.NotifyPropertyChanged("Screen"); break; case ((int)ContextMenuItem.AddToWatchList): TraktHelper.AddEpisodeToWatchList(selectedShow, selectedEpisode); selectedEpisode.InWatchList = true; OnEpisodeSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIEpisodeListItem).Images.NotifyPropertyChanged("Screen"); break; case ((int)ContextMenuItem.RemoveFromWatchList): TraktHelper.RemoveEpisodeFromWatchList(selectedShow, selectedEpisode); selectedEpisode.InWatchList = false; OnEpisodeSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIEpisodeListItem).Images.NotifyPropertyChanged("Screen"); break; case ((int)ContextMenuItem.AddToList): TraktHelper.AddRemoveEpisodeInUserList(selectedShow, selectedEpisode, false); break; case ((int)ContextMenuItem.Trailers): PreviousUser = CurrentUser; GUICommon.ShowTVShowTrailersMenu(selectedShow, selectedEpisode); break; case ((int)ContextMenuItem.AddToLibrary): TraktHelper.AddEpisodeToLibrary(selectedShow, selectedEpisode); selectedEpisode.InCollection = true; OnEpisodeSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIEpisodeListItem).Images.NotifyPropertyChanged("Screen"); break; case ((int)ContextMenuItem.RemoveFromLibrary): TraktHelper.RemoveEpisodeFromLibrary(selectedShow, selectedEpisode); selectedEpisode.InCollection = false; OnEpisodeSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIEpisodeListItem).Images.NotifyPropertyChanged("Screen"); break; case ((int)ContextMenuItem.Related): TraktHelper.ShowRelatedShows(selectedShow); break; case ((int)ContextMenuItem.Rate): GUICommon.RateEpisode(selectedShow, selectedEpisode); OnEpisodeSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIEpisodeListItem).Images.NotifyPropertyChanged("Screen"); break; case ((int)ContextMenuItem.Shouts): TraktHelper.ShowEpisodeShouts(selectedShow, selectedEpisode); break; case ((int)ContextMenuItem.ChangeLayout): CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout, PreviousSelectedIndex); break; case ((int)ContextMenuItem.SearchWithMpNZB): string loadingParam = string.Format("search:{0} S{1}E{2}", selectedShow.Title, selectedEpisode.Season.ToString("D2"), selectedEpisode.Number.ToString("D2")); GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam); break; case ((int)ContextMenuItem.SearchTorrent): string loadPar = string.Format("{0} S{1}E{2}", selectedShow.Title, selectedEpisode.Season.ToString("D2"), selectedEpisode.Number.ToString("D2")); GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar); break; default: break; } base.OnShowContextMenu(); }
internal void MyContextMenu() { try { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(924); //Add Details Menu Item //Play Menu Item GUIListItem pItem = new GUIListItem(Translation.Play); dlg.Add(pItem); pItem.ItemId = 1; pItem = new GUIListItem(Translation.MovieDetails); dlg.Add(pItem); pItem.ItemId = 2; //Add Watched/Unwatched Filter Menu Item if (CurrentFacade.UnWatched) { pItem = new GUIListItem(Translation.ShowUnwatchedMovies); dlg.Add(pItem); pItem.ItemId = 3; } else { pItem = new GUIListItem(Translation.ShowAllMovies); dlg.Add(pItem); pItem.ItemId = 3; } //Add Latests/Watched/Rated Menu Item pItem = new GUIListItem("[^] " + CurrentFacade.Title); dlg.Add(pItem); pItem.ItemId = 4; pItem = new GUIListItem(); pItem.Label = Translation.Update; pItem.ItemId = 5; dlg.Add(pItem); //Show Dialog dlg.DoModal(Utils.ActiveWindow); if (dlg.SelectedLabel == -1) { return; } switch (dlg.SelectedId) { case 1: { PlayMovie(GUIWindowManager.GetWindow(Utils.ActiveWindow)); break; } case 2: { ShowInfo(); break; } case 3: { CurrentFacade.UnWatched = !CurrentFacade.UnWatched; MyVideosUpdateLatest(); break; } case 4: { IDialogbox ldlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (ldlg == null) { return; } ldlg.Reset(); ldlg.SetHeading(924); //Add Types Menu Items pItem = new GUIListItem((CurrentFacade.Type == LatestsFacadeType.Latests ? "[x] " : string.Empty) + Translation.LabelLatestAdded); ldlg.Add(pItem); pItem.ItemId = 1; pItem = new GUIListItem((CurrentFacade.Type == LatestsFacadeType.Watched ? "[x] " : string.Empty) + Translation.LabelLatestWatched); ldlg.Add(pItem); pItem.ItemId = 2; pItem = new GUIListItem((CurrentFacade.Type == LatestsFacadeType.Rated ? "[x] " : string.Empty) + Translation.LabelHighestRated); ldlg.Add(pItem); pItem.ItemId = 3; //Show Dialog ldlg.DoModal(Utils.ActiveWindow); if (ldlg.SelectedLabel == -1) { return; } switch (ldlg.SelectedId - 1) { case 0: CurrentFacade.Type = LatestsFacadeType.Latests; break; case 1: CurrentFacade.Type = LatestsFacadeType.Watched; break; case 2: CurrentFacade.Type = LatestsFacadeType.Rated; break; } MyVideosUpdateLatest(); break; } case 5: { MyVideosUpdateLatest(); break; } } } catch (Exception ex) { logger.Error("MyContextMenu: " + ex.ToString()); } }
protected override void OnShowContextMenu() { if (GUIBackgroundTask.Instance.IsBusy) { return; } GUIListItem selectedItem = this.Facade.SelectedListItem; if (selectedItem == null) { return; } TraktShout selectedShout = (TraktShout)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; if (ShoutType == ShoutTypeEnum.episode) { listItem = new GUIListItem(Translation.NextEpisode); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.NextEpisode; if (int.Parse(EpisodeInfo.EpisodeIdx) > 1) { listItem = new GUIListItem(Translation.PreviousEpisode); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.PrevEpisode; } } listItem = new GUIListItem(TraktSettings.HideSpoilersOnShouts ? Translation.ShowSpoilers : Translation.HideSpoilers); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Spoilers; // Show Context Menu dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId < 0) { return; } switch (dlg.SelectedId) { case ((int)ContextMenuItem.Spoilers): TraktSettings.HideSpoilersOnShouts = !TraktSettings.HideSpoilersOnShouts; if (hideSpoilersButton != null) { hideSpoilersButton.Selected = TraktSettings.HideSpoilersOnShouts; } PublishShoutSkinProperties(selectedShout); break; case ((int)ContextMenuItem.NextEpisode): GetNextEpisodeShouts(); break; case ((int)ContextMenuItem.PrevEpisode): GetPrevEpisodeShouts(); break; default: break; } base.OnShowContextMenu(); }
protected override void OnShowContextMenu() { if (GUIBackgroundTask.Instance.IsBusy) { return; } GUIListItem selectedItem = this.Facade.SelectedListItem; if (selectedItem == null) { return; } TraktUserList selectedList = (TraktUserList)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; // only allow add/delete/update if viewing your own lists if (CurrentUser == TraktSettings.Username) { listItem = new GUIListItem(Translation.CreateList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Create; listItem = new GUIListItem(Translation.EditList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Edit; listItem = new GUIListItem(Translation.DeleteList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Delete; } else { // copy a friends list listItem = new GUIListItem(Translation.CopyList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Copy; } // Show Context Menu dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId < 0) { return; } TraktList currentList = new TraktList { Name = selectedList.Name, Description = selectedList.Description, Privacy = selectedList.Privacy, Slug = selectedList.Slug, ShowNumbers = selectedList.ShowNumbers, AllowShouts = selectedList.AllowShouts }; switch (dlg.SelectedId) { case ((int)ContextMenuItem.Create): TraktList list = new TraktList(); if (TraktLists.GetListDetailsFromUser(ref list)) { if (Lists.ToList().Exists(l => l.Name == list.Name)) { // list with that name already exists GUIUtils.ShowNotifyDialog(Translation.Lists, Translation.ListNameAlreadyExists); return; } TraktLogger.Info("Creating new '{0}' list '{1}'", list.Privacy, list.Name); CreateList(list); } break; case ((int)ContextMenuItem.Delete): DeleteList(selectedList); break; case ((int)ContextMenuItem.Edit): if (TraktLists.GetListDetailsFromUser(ref currentList)) { TraktLogger.Info("Editing list '{0}'", currentList.Slug); EditList(currentList); } break; case ((int)ContextMenuItem.Copy): if (TraktLists.GetListDetailsFromUser(ref currentList)) { CopyList(selectedList, currentList); } break; default: break; } base.OnShowContextMenu(); }
protected override void OnShowContextMenu() { var selectedItem = this.Facade.SelectedListItem as GUIMovieListItem; if (selectedItem == null) { return; } var selectedMovie = selectedItem.TVTag as TraktMovieSummary; if (selectedMovie == null) { return; } IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(GUIUtils.PluginName()); GUIListItem listItem = null; // Dismiss Recommendation listItem = new GUIListItem(Translation.DismissRecommendation); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.DismissRecommendation; // Mark As Watched // This should remove item from recommendations if executed if (!selectedMovie.IsWatched()) { listItem = new GUIListItem(Translation.MarkAsWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsWatched; } // Add/Remove Watchlist if (!selectedMovie.IsWatchlisted()) { listItem = new GUIListItem(Translation.AddToWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToWatchList; } else { listItem = new GUIListItem(Translation.RemoveFromWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList; } // Add to Custom List listItem = new GUIListItem(Translation.AddToList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToList; // Add to Library // Don't allow if it will be removed again on next sync // movie could be part of a DVD collection if (!selectedMovie.IsCollected() && !TraktSettings.KeepTraktLibraryClean) { listItem = new GUIListItem(Translation.AddToLibrary); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToLibrary; } if (selectedMovie.IsCollected()) { listItem = new GUIListItem(Translation.RemoveFromLibrary); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromLibrary; } // Related Movies listItem = new GUIListItem(Translation.RelatedMovies); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Related; // Rate Movie listItem = new GUIListItem(Translation.RateMovie); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Rate; // Shouts listItem = new GUIListItem(Translation.Comments); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Shouts; // 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) { // Trailers listItem = new GUIListItem(Translation.Trailers); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Trailers; } // Change Layout listItem = new GUIListItem(Translation.ChangeLayout); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.ChangeLayout; if (!selectedMovie.IsCollected() && TraktHelper.IsMpNZBAvailableAndEnabled) { // Search for movie with mpNZB listItem = new GUIListItem(Translation.SearchWithMpNZB); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB; } if (!selectedMovie.IsCollected() && TraktHelper.IsMyTorrentsAvailableAndEnabled) { // Search for movie with MyTorrents listItem = new GUIListItem(Translation.SearchTorrent); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchTorrent; } // Show Context Menu dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId < 0) { return; } switch (dlg.SelectedId) { case ((int)ContextMenuItem.DismissRecommendation): PreviousSelectedIndex = this.Facade.SelectedListItemIndex; DismissRecommendation(selectedMovie); if (_RecommendedMovies.Count() > 1) { var moviesToExcept = new List <TraktMovieSummary>(); moviesToExcept.Add(selectedMovie); _RecommendedMovies = RecommendedMovies.Except(moviesToExcept); } else { // reload, none left ClearProperties(); GUIControl.ClearControl(GetID, Facade.GetID); _RecommendedMovies = null; } LoadRecommendedMovies(); break; case ((int)ContextMenuItem.MarkAsWatched): PreviousSelectedIndex = this.Facade.SelectedListItemIndex; TraktHelper.AddMovieToWatchHistory(selectedMovie); if (_RecommendedMovies.Count() > 1) { var moviesToExcept = new List <TraktMovieSummary>(); moviesToExcept.Add(selectedMovie); _RecommendedMovies = RecommendedMovies.Except(moviesToExcept); } else { // reload, none left ClearProperties(); GUIControl.ClearControl(GetID, Facade.GetID); _RecommendedMovies = null; } LoadRecommendedMovies(); break; case ((int)ContextMenuItem.AddToWatchList): TraktHelper.AddMovieToWatchList(selectedMovie, true); OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.RemoveFromWatchList): TraktHelper.RemoveMovieFromWatchList(selectedMovie, true); OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.AddToList): TraktHelper.AddRemoveMovieInUserList(selectedMovie, false); break; case ((int)ContextMenuItem.AddToLibrary): TraktHelper.AddMovieToCollection(selectedMovie); OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.RemoveFromLibrary): TraktHelper.RemoveMovieFromCollection(selectedMovie); OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.Related): TraktHelper.ShowRelatedMovies(selectedMovie); break; case ((int)ContextMenuItem.Rate): PreviousSelectedIndex = this.Facade.SelectedListItemIndex; if (GUICommon.RateMovie(selectedMovie)) { // also mark as watched TraktHelper.AddMovieToWatchHistory(selectedMovie); // remove from recommendations if (_RecommendedMovies.Count() > 1) { var moviesToExcept = new List <TraktMovieSummary>(); moviesToExcept.Add(selectedMovie); _RecommendedMovies = RecommendedMovies.Except(moviesToExcept); } else { // reload, none left ClearProperties(); GUIControl.ClearControl(GetID, Facade.GetID); _RecommendedMovies = null; } LoadRecommendedMovies(); } break; case ((int)ContextMenuItem.Shouts): TraktHelper.ShowMovieShouts(selectedMovie); break; case ((int)ContextMenuItem.Cast): GUICreditsMovie.Movie = selectedMovie; GUICreditsMovie.Type = GUICreditsMovie.CreditType.Cast; GUICreditsMovie.Fanart = TmdbCache.GetMovieBackdropFilename(selectedItem.Images.MovieImages); GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsMovie); break; case ((int)ContextMenuItem.Crew): GUICreditsMovie.Movie = selectedMovie; GUICreditsMovie.Type = GUICreditsMovie.CreditType.Crew; GUICreditsMovie.Fanart = TmdbCache.GetMovieBackdropFilename(selectedItem.Images.MovieImages); GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsMovie); break; case ((int)ContextMenuItem.Trailers): GUICommon.ShowMovieTrailersMenu(selectedMovie); break; case ((int)ContextMenuItem.ChangeLayout): CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout, PreviousSelectedIndex); break; case ((int)ContextMenuItem.SearchWithMpNZB): string loadingParam = string.Format("search:{0}", selectedMovie.Title); GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam); break; case ((int)ContextMenuItem.SearchTorrent): string loadPar = selectedMovie.Title; GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar); break; default: break; } base.OnShowContextMenu(); }
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(); }
protected override void OnShowContextMenu() { GUIListItem selectedItem = this.Facade.SelectedListItem; if (selectedItem == null) { return; } TraktUserListItem userListItem = (TraktUserListItem)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; if (SelectedType == TraktItemType.movie || SelectedType == TraktItemType.episode) { // Mark As Watched if (!userListItem.Watched) { listItem = new GUIListItem(Translation.MarkAsWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsWatched; } // Mark As UnWatched if (userListItem.Watched) { listItem = new GUIListItem(Translation.MarkAsUnWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsUnWatched; } } if (SelectedType != TraktItemType.season) { // Add/Remove Watch List if (!userListItem.InWatchList) { listItem = new GUIListItem(Translation.AddToWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToWatchList; } else { listItem = new GUIListItem(Translation.RemoveFromWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList; } } // Add to Custom list listItem = new GUIListItem(Translation.AddToList + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToList; // Remove from Custom list (Only if current user is the active user) if (TraktSettings.Username == CurrentUser) { listItem = new GUIListItem(Translation.RemoveFromList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromList; } if (SelectedType == TraktItemType.movie || SelectedType == TraktItemType.episode) { // Add to Library // Don't allow if it will be removed again on next sync // movie could be part of a DVD collection if (!userListItem.InCollection && !TraktSettings.KeepTraktLibraryClean) { listItem = new GUIListItem(Translation.AddToLibrary); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToLibrary; } if (userListItem.InCollection) { listItem = new GUIListItem(Translation.RemoveFromLibrary); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromLibrary; } } // Related Movies/Shows listItem = new GUIListItem(SelectedType == TraktItemType.movie ? Translation.RelatedMovies : Translation.RelatedShows + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Related; if (SelectedType != TraktItemType.season) { // Rate listItem = new GUIListItem(Translation.Rate + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Rate; // Shouts listItem = new GUIListItem(Translation.Shouts + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Shouts; } // Trailers if (TraktHelper.IsOnlineVideosAvailableAndEnabled) { listItem = new GUIListItem(Translation.Trailers); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Trailers; } // Search with mpNZB if (TraktHelper.IsMpNZBAvailableAndEnabled) { if ((userListItem.Movie != null && !userListItem.Movie.InCollection) || userListItem.Episode != null) { listItem = new GUIListItem(Translation.SearchWithMpNZB); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB; } } // Search with MyTorrents if (TraktHelper.IsMyTorrentsAvailableAndEnabled) { if ((userListItem.Movie != null && !userListItem.Movie.InCollection) || userListItem.Episode != null) { listItem = new GUIListItem(Translation.SearchTorrent); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchTorrent; } } // 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): MarkItemAsWatched(userListItem); if (userListItem.Plays == 0) { userListItem.Plays = 1; } userListItem.Watched = true; selectedItem.IsPlayed = true; OnItemSelected(selectedItem, Facade); if (SelectedType == TraktItemType.movie) { userListItem.Movie.Images.NotifyPropertyChanged("PosterImageFilename"); } else { userListItem.Show.Images.NotifyPropertyChanged("PosterImageFilename"); } break; case ((int)ContextMenuItem.MarkAsUnWatched): MarkItemAsUnWatched(userListItem); userListItem.Watched = false; selectedItem.IsPlayed = false; OnItemSelected(selectedItem, Facade); if (SelectedType == TraktItemType.movie) { userListItem.Movie.Images.NotifyPropertyChanged("PosterImageFilename"); } else { userListItem.Show.Images.NotifyPropertyChanged("PosterImageFilename"); } break; case ((int)ContextMenuItem.AddToWatchList): AddItemToWatchList(userListItem); userListItem.InWatchList = true; OnItemSelected(selectedItem, Facade); if (SelectedType == TraktItemType.movie) { userListItem.Movie.Images.NotifyPropertyChanged("PosterImageFilename"); } else { userListItem.Show.Images.NotifyPropertyChanged("PosterImageFilename"); } GUIWatchListMovies.ClearCache(TraktSettings.Username); break; case ((int)ContextMenuItem.RemoveFromWatchList): RemoveItemFromWatchList(userListItem); userListItem.InWatchList = false; OnItemSelected(selectedItem, Facade); if (SelectedType == TraktItemType.movie) { userListItem.Movie.Images.NotifyPropertyChanged("PosterImageFilename"); } else { userListItem.Show.Images.NotifyPropertyChanged("PosterImageFilename"); } GUIWatchListMovies.ClearCache(TraktSettings.Username); break; case ((int)ContextMenuItem.AddToList): if (SelectedType == TraktItemType.movie) { TraktHelper.AddRemoveMovieInUserList(userListItem.Title, userListItem.Year, userListItem.ImdbId, false); } else if (SelectedType == TraktItemType.show) { TraktHelper.AddRemoveShowInUserList(userListItem.Title, userListItem.Year, userListItem.Show.Tvdb, false); } else if (SelectedType == TraktItemType.season) { TraktHelper.AddRemoveSeasonInUserList(userListItem.Title, userListItem.Year, userListItem.SeasonNumber, userListItem.Show.Tvdb, false); } else if (SelectedType == TraktItemType.episode) { TraktHelper.AddRemoveEpisodeInUserList(userListItem.Title, userListItem.Year, userListItem.SeasonNumber, userListItem.EpisodeNumber, userListItem.Show.Tvdb, false); } break; case ((int)ContextMenuItem.RemoveFromList): if (!GUIUtils.ShowYesNoDialog(Translation.DeleteListItem, Translation.ConfirmDeleteListItem)) { break; } // Only do remove from current list // We could do same as Add (ie remove from multile lists) but typically you only remove from the current list if (SelectedType == TraktItemType.movie) { TraktListItem item = new TraktListItem { Type = "movie", ImdbId = userListItem.ImdbId, Title = userListItem.Title, Year = Convert.ToInt32(userListItem.Year) }; TraktHelper.AddRemoveItemInList(CurrentList.Slug, item, true); } else if (SelectedType == TraktItemType.show) { TraktListItem item = new TraktListItem { Type = "show", TvdbId = userListItem.Show.Tvdb, Title = userListItem.Title, Year = Convert.ToInt32(userListItem.Year) }; TraktHelper.AddRemoveItemInList(CurrentList.Slug, item, true); } else if (SelectedType == TraktItemType.season) { TraktListItem item = new TraktListItem { Type = "season", TvdbId = userListItem.Show.Tvdb, Title = userListItem.Title, Year = Convert.ToInt32(userListItem.Year), Season = Convert.ToInt32(userListItem.SeasonNumber) }; TraktHelper.AddRemoveItemInList(CurrentList.Slug, item, true); } else if (SelectedType == TraktItemType.episode) { TraktListItem item = new TraktListItem { Type = "episode", TvdbId = userListItem.Show.Tvdb, Title = userListItem.Title, Year = Convert.ToInt32(userListItem.Year), Season = Convert.ToInt32(userListItem.SeasonNumber), Episode = Convert.ToInt32(userListItem.EpisodeNumber) }; TraktHelper.AddRemoveItemInList(CurrentList.Slug, item, true); } // Remove from view if (Facade.Count > 1) { PreviousSelectedIndex = Facade.SelectedListItemIndex; CurrentList.Items.Remove(userListItem); SendListItemsToFacade(CurrentList); } else { CurrentList.Items.Remove(userListItem); // no more items left GUIControl.ClearControl(GetID, Facade.GetID); ClearProperties(); GUIWindowManager.Process(); // nothing left, exit GUIWindowManager.ShowPreviousWindow(); return; } break; case ((int)ContextMenuItem.AddToLibrary): AddItemToLibrary(userListItem); userListItem.InCollection = true; OnItemSelected(selectedItem, Facade); if (SelectedType == TraktItemType.movie) { userListItem.Movie.Images.NotifyPropertyChanged("PosterImageFilename"); } else { userListItem.Show.Images.NotifyPropertyChanged("PosterImageFilename"); } break; case ((int)ContextMenuItem.RemoveFromLibrary): RemoveItemFromLibrary(userListItem); userListItem.InCollection = false; OnItemSelected(selectedItem, Facade); if (SelectedType == TraktItemType.movie) { userListItem.Movie.Images.NotifyPropertyChanged("PosterImageFilename"); } else { userListItem.Show.Images.NotifyPropertyChanged("PosterImageFilename"); } break; case ((int)ContextMenuItem.Related): if (SelectedType == TraktItemType.movie) { RelatedMovie relatedMovie = new RelatedMovie(); relatedMovie.IMDbId = userListItem.Movie.IMDBID; relatedMovie.Title = userListItem.Movie.Title; GUIRelatedMovies.relatedMovie = relatedMovie; GUIWindowManager.ActivateWindow((int)TraktGUIWindows.RelatedMovies); } else { //series, season & episode RelatedShow relatedShow = new RelatedShow(); relatedShow.Title = userListItem.Show.Title; relatedShow.TVDbId = userListItem.Show.Tvdb; GUIRelatedShows.relatedShow = relatedShow; GUIWindowManager.ActivateWindow((int)TraktGUIWindows.RelatedShows); } break; case ((int)ContextMenuItem.Rate): RateItem(userListItem); OnItemSelected(selectedItem, Facade); if (SelectedType == TraktItemType.movie) { userListItem.Movie.Images.NotifyPropertyChanged("PosterImageFilename"); } else { userListItem.Show.Images.NotifyPropertyChanged("PosterImageFilename"); } break; case ((int)ContextMenuItem.Shouts): GUIShouts.ShoutType = (GUIShouts.ShoutTypeEnum)Enum.Parse(typeof(GUIShouts.ShoutTypeEnum), SelectedType.ToString(), true); if (SelectedType == TraktItemType.movie) { GUIShouts.MovieInfo = new MovieShout { IMDbId = userListItem.ImdbId, TMDbId = userListItem.Movie.TMDBID, Title = userListItem.Title, Year = userListItem.Year } } ; else if (SelectedType == TraktItemType.show) { GUIShouts.ShowInfo = new ShowShout { IMDbId = userListItem.ImdbId, TVDbId = userListItem.Show.Tvdb, Title = userListItem.Title } } ; else { GUIShouts.EpisodeInfo = new EpisodeShout { IMDbId = userListItem.ImdbId, TVDbId = userListItem.Show.Tvdb, Title = userListItem.Title, SeasonIdx = userListItem.SeasonNumber, EpisodeIdx = userListItem.EpisodeNumber } }; GUIShouts.Fanart = SelectedType == TraktItemType.movie ? (userListItem.Images as TraktMovie.MovieImages).FanartImageFilename : (userListItem.Images as TraktShow.ShowImages).FanartImageFilename; GUIWindowManager.ActivateWindow((int)TraktGUIWindows.Shouts); break; case ((int)ContextMenuItem.Trailers): if (SelectedType == TraktItemType.movie) { GUICommon.ShowMovieTrailersMenu(userListItem.Movie); } else { GUICommon.ShowTVShowTrailersMenu(userListItem.Show, userListItem.Episode); } break; case ((int)ContextMenuItem.SearchWithMpNZB): string loadingParam = String.Empty; if (userListItem.Movie != null) { loadingParam = string.Format("search:{0}", userListItem.Movie.Title); } else if (userListItem.Episode != null) { loadingParam = string.Format("search:{0} S{1}E{2}", userListItem.Show.Title, userListItem.Episode.Season.ToString("D2"), userListItem.Episode.Number.ToString("D2")); } GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam); break; case ((int)ContextMenuItem.SearchTorrent): string loadPar = String.Empty; if (userListItem.Movie != null) { loadPar = userListItem.Movie.Title; } else if (userListItem.Episode != null) { loadPar = string.Format("{0} S{1}E{2}", userListItem.Show.Title, userListItem.Episode.Season.ToString("D2"), userListItem.Episode.Number.ToString("D2")); } GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar); break; case ((int)ContextMenuItem.ChangeLayout): CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout); break; default: break; } base.OnShowContextMenu(); }
protected override void OnShowContextMenu() { GUIListItem selectedItem = this.Facade.SelectedListItem; if (selectedItem == null) { return; } var item = (KeyValuePair <TraktShow, TraktWatchListEpisode.Episode>)selectedItem.TVTag; var selectedSeries = item.Key; var selectedEpisode = item.Value; IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(GUIUtils.PluginName()); GUIListItem listItem = null; if (CurrentUser == TraktSettings.Username) { listItem = new GUIListItem(Translation.RemoveFromWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList; } if (TraktHelper.IsOnlineVideosAvailableAndEnabled) { listItem = new GUIListItem(Translation.Trailers); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Trailers; } // Add to Custom List listItem = new GUIListItem(Translation.AddToList + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToList; // Shouts listItem = new GUIListItem(Translation.Shouts + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Shouts; // Change Layout listItem = new GUIListItem(Translation.ChangeLayout); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.ChangeLayout; if (TraktHelper.IsMpNZBAvailableAndEnabled) { // Search for show with mpNZB listItem = new GUIListItem(Translation.SearchWithMpNZB); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB; } if (TraktHelper.IsMyTorrentsAvailableAndEnabled) { // Search for show with MyTorrents listItem = new GUIListItem(Translation.SearchTorrent); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchTorrent; } // Show Context Menu dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId < 0) { return; } switch (dlg.SelectedId) { case ((int)ContextMenuItem.RemoveFromWatchList): RemovingWatchListItem = true; PreviousSelectedIndex = this.Facade.SelectedListItemIndex; RemoveEpisodeFromWatchList(item); if (this.Facade.Count >= 1) { // remove from list _WatchListEpisodes = null; userWatchList.Remove(CurrentUser); LoadWatchListEpisodes(); } else { // no more shows left ClearProperties(); GUIControl.ClearControl(GetID, Facade.GetID); _WatchListEpisodes = null; userWatchList.Remove(CurrentUser); // notify and exit GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoShowWatchList); GUIWindowManager.ShowPreviousWindow(); return; } break; case ((int)ContextMenuItem.AddToList): TraktHelper.AddRemoveEpisodeInUserList(selectedSeries.Title, selectedSeries.Year.ToString(), selectedEpisode.Season.ToString(), selectedEpisode.Number.ToString(), selectedSeries.Tvdb, false); break; case ((int)ContextMenuItem.Trailers): GUICommon.ShowTVShowTrailersMenu(selectedSeries, selectedEpisode); break; case ((int)ContextMenuItem.Shouts): GUIShouts.ShoutType = GUIShouts.ShoutTypeEnum.episode; GUIShouts.EpisodeInfo = new EpisodeShout { TVDbId = selectedSeries.Tvdb, IMDbId = selectedSeries.Imdb, Title = selectedSeries.Title, SeasonIdx = selectedEpisode.Season.ToString(), EpisodeIdx = selectedEpisode.Number.ToString() }; GUIShouts.Fanart = selectedSeries.Images.FanartImageFilename; GUIWindowManager.ActivateWindow((int)TraktGUIWindows.Shouts); break; case ((int)ContextMenuItem.ChangeLayout): CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout); break; case ((int)ContextMenuItem.SearchWithMpNZB): string loadingParam = string.Format("search:{0} S{1}E{2}", selectedSeries.Title, selectedEpisode.Season.ToString("D2"), selectedEpisode.Number.ToString("D2")); GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam); break; case ((int)ContextMenuItem.SearchTorrent): string loadPar = string.Format("{0} S{1}E{2}", selectedSeries.Title, selectedEpisode.Season.ToString("D2"), selectedEpisode.Number.ToString("D2")); GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar); break; default: break; } base.OnShowContextMenu(); }
protected override void OnShowContextMenu() { GUIListItem selectedItem = this.Facade.SelectedListItem; if (selectedItem == null) { return; } var selectedShow = selectedItem.TVTag as TraktShow; if (selectedShow == null) { return; } IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(GUIUtils.PluginName()); GUIListItem listItem = null; listItem = new GUIListItem(Translation.DismissRecommendation); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.DismissRecommendation; // Show Season Information listItem = new GUIListItem(Translation.ShowSeasonInfo); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.ShowSeasonInfo; // Add/Remove Watch List if (!selectedShow.InWatchList) { listItem = new GUIListItem(Translation.AddToWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToWatchList; } else { listItem = new GUIListItem(Translation.RemoveFromWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList; } listItem = new GUIListItem(Translation.AddToList + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToList; if (TraktHelper.IsOnlineVideosAvailableAndEnabled) { listItem = new GUIListItem(Translation.Trailers); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Trailers; } // Related Shows listItem = new GUIListItem(Translation.RelatedShows + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Related; // Rate Show listItem = new GUIListItem(Translation.RateShow); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Rate; // Shouts listItem = new GUIListItem(Translation.Shouts + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Shouts; // Change Layout listItem = new GUIListItem(Translation.ChangeLayout); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.ChangeLayout; if (TraktHelper.IsMpNZBAvailableAndEnabled) { // Search for show with mpNZB listItem = new GUIListItem(Translation.SearchWithMpNZB); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB; } if (TraktHelper.IsMyTorrentsAvailableAndEnabled) { // Search for show with MyTorrents listItem = new GUIListItem(Translation.SearchTorrent); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchTorrent; } // Show Context Menu dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId < 0) { return; } switch (dlg.SelectedId) { case ((int)ContextMenuItem.DismissRecommendation): PreviousSelectedIndex = this.Facade.SelectedListItemIndex; DismissRecommendation(selectedShow); if (_RecommendedShows.Count() > 1) { var showsToExcept = new List <TraktShow>(); showsToExcept.Add(selectedShow); _RecommendedShows = RecommendedShows.Except(showsToExcept); } else { // reload, none left ClearProperties(); GUIControl.ClearControl(GetID, Facade.GetID); _RecommendedShows = null; } LoadRecommendedShows(); break; case ((int)ContextMenuItem.ShowSeasonInfo): GUIWindowManager.ActivateWindow((int)TraktGUIWindows.ShowSeasons, selectedShow.ToJSON()); break; case ((int)ContextMenuItem.AddToWatchList): TraktHelper.AddShowToWatchList(selectedShow); selectedShow.InWatchList = true; OnShowSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIShowListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.RemoveFromWatchList): TraktHelper.RemoveShowFromWatchList(selectedShow); selectedShow.InWatchList = false; OnShowSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIShowListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.AddToList): TraktHelper.AddRemoveShowInUserList(selectedShow.Title, selectedShow.Year.ToString(), selectedShow.Tvdb, false); break; case ((int)ContextMenuItem.Related): TraktHelper.ShowRelatedShows(selectedShow); break; case ((int)ContextMenuItem.Trailers): GUICommon.ShowTVShowTrailersMenu(selectedShow); break; case ((int)ContextMenuItem.Shouts): TraktHelper.ShowTVShowShouts(selectedShow); break; case ((int)ContextMenuItem.Rate): PreviousSelectedIndex = this.Facade.SelectedListItemIndex; if (GUICommon.RateShow(selectedShow)) { // remove from recommendations if (_RecommendedShows.Count() > 1) { var showsToExcept = new List <TraktShow>(); showsToExcept.Add(selectedShow); _RecommendedShows = RecommendedShows.Except(showsToExcept); } else { // reload, none left ClearProperties(); GUIControl.ClearControl(GetID, Facade.GetID); _RecommendedShows = null; } LoadRecommendedShows(); } break; case ((int)ContextMenuItem.ChangeLayout): CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout, PreviousSelectedIndex); break; case ((int)ContextMenuItem.SearchWithMpNZB): string loadingParam = string.Format("search:{0}", selectedShow.Title); GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam); break; case ((int)ContextMenuItem.SearchTorrent): string loadPar = selectedShow.Title; GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar); break; default: break; } base.OnShowContextMenu(); }
protected override void OnShowContextMenu() { GUIListItem selectedItem = this.Facade.SelectedListItem; if (selectedItem == null) { return; } TraktTrendingMovie selectedMovie = (TraktTrendingMovie)selectedItem.TVTag; IDialogbox 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); selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename"); if (TraktSettings.TrendingMoviesHideWatched) { LoadTrendingMovies(); } break; case ((int)TrendingContextMenuItem.MarkAsUnWatched): TraktHelper.MarkMovieAsUnWatched(selectedMovie); selectedMovie.Watched = false; selectedItem.IsPlayed = false; OnMovieSelected(selectedItem, Facade); selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename"); break; case ((int)TrendingContextMenuItem.AddToWatchList): TraktHelper.AddMovieToWatchList(selectedMovie, true); selectedMovie.InWatchList = true; OnMovieSelected(selectedItem, Facade); selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename"); if (TraktSettings.TrendingMoviesHideWatchlisted) { LoadTrendingMovies(); } break; case ((int)TrendingContextMenuItem.RemoveFromWatchList): TraktHelper.RemoveMovieFromWatchList(selectedMovie, true); selectedMovie.InWatchList = false; OnMovieSelected(selectedItem, Facade); selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename"); break; case ((int)TrendingContextMenuItem.AddToList): TraktHelper.AddRemoveMovieInUserList(selectedMovie, false); break; case ((int)TrendingContextMenuItem.AddToLibrary): TraktHelper.AddMovieToLibrary(selectedMovie); selectedMovie.InCollection = true; OnMovieSelected(selectedItem, Facade); selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename"); if (TraktSettings.TrendingMoviesHideCollected) { LoadTrendingMovies(); } break; case ((int)TrendingContextMenuItem.RemoveFromLibrary): TraktHelper.RemoveMovieFromLibrary(selectedMovie); selectedMovie.InCollection = false; OnMovieSelected(selectedItem, Facade); selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename"); break; case ((int)TrendingContextMenuItem.Related): TraktHelper.ShowRelatedMovies(selectedMovie); break; case ((int)TrendingContextMenuItem.Rate): GUICommon.RateMovie(selectedMovie); OnMovieSelected(selectedItem, Facade); selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename"); 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); 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(); }
private void ShowSongContext(PandoraSong song) { if (song.IsAdvertisement) { return; } IDialogbox dialog = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); dialog.Reset(); dialog.SetHeading("Song Options - " + song.Title); GUIListItem thumbsUpItem = new GUIListItem("I like this song."); dialog.Add(thumbsUpItem); GUIListItem thumbsDownItem = new GUIListItem("I don't like this song."); dialog.Add(thumbsDownItem); GUIListItem tempBanItem = new GUIListItem("I am tired of this song."); dialog.Add(tempBanItem); dialog.DoModal(GUIWindowManager.ActiveWindow); GUIListItem whySelectedItem = new GUIListItem("Why was this song selected?"); //dialog.Add(whySelectedItem); GUIListItem moveSongItem = new GUIListItem("Move Song to Another Station..."); dialog.Add(moveSongItem); if (dialog.SelectedId == thumbsUpItem.ItemId) { RateSong(song, PandoraRating.Love); } else if (dialog.SelectedId == thumbsDownItem.ItemId) { RateSong(song, PandoraRating.Hate); } else if (dialog.SelectedId == whySelectedItem.ItemId) { // todo: show the reason song was selected } else if (dialog.SelectedId == moveSongItem.ItemId) { PandoraStation newStation = ShowStationChooser(); if (newStation != null) { // todo: move song to new station } } else if (dialog.SelectedId == tempBanItem.ItemId) { TemporarilyBanSong(song); } }
public bool ResumeOrPlay(VM_AnimeEpisode_User episode) { try { // get the list if FileLocal records for this AnimeEpisode List <VM_VideoDetailed> fileLocalList = episode.FilesForEpisode; if (fileLocalList.Count == 0) { return(false); } VM_VideoDetailed fileToPlay = null; if (fileLocalList.Count == 1) { fileToPlay = fileLocalList[0]; } else { // ask the user which file they want to play IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); dlg.Reset(); dlg.SetHeading("Select File"); GUIListItem pItem = null; foreach (VM_VideoDetailed fl in fileLocalList) { pItem = new GUIListItem(fl.FileSelectionDisplay); dlg.Add(pItem); } dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId > 0) { fileToPlay = fileLocalList[dlg.SelectedId - 1]; } } if (fileToPlay == null) { return(false); } previous = current; previousUri = currentUri; current = fileToPlay; BaseConfig.MyAnimeLog.Write("Filetoplay: {0}", fileToPlay.FileName); if (!fileToPlay.IsLocalOrStreaming() == null) { Utils.DialogMsg("Error", "File could not be found!"); return(false); } BaseConfig.MyAnimeLog.Write("Getting time stopped for : {0}", fileToPlay.FileName); _timeMovieStopped = (int)(fileToPlay.VideoLocal_ResumePosition / 1000); BaseConfig.MyAnimeLog.Write("Time stopped for : {0} - {1}", fileToPlay.FileName, _timeMovieStopped); prevEpisode = curEpisode; curEpisode = episode; #region Ask user to Resume if (_timeMovieStopped > 0) { //MPTVSeriesLog.Write("Asking user to resume episode from: " + Utils.SecondsToHMSString(timeMovieStopped)); GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); if (null != dlgYesNo) { dlgYesNo.SetHeading(GUILocalizeStrings.Get(900)); //resume movie? dlgYesNo.SetLine(1, episode.EpisodeName); dlgYesNo.SetLine(2, GUILocalizeStrings.Get(936) + " " + MediaPortal.Util.Utils.SecondsToHMSString(_timeMovieStopped)); dlgYesNo.SetDefaultToYes(true); dlgYesNo.DoModal(GUIWindowManager.ActiveWindow); if (!dlgYesNo.IsConfirmed) // reset resume data in DB { _timeMovieStopped = 0; //MPTVSeriesLog.Write("User selected to start episode from beginning", MPTVSeriesLog.LogLevel.Debug); } } } #endregion Play(_timeMovieStopped, curEpisode.DefaultAudioLanguage, curEpisode.DefaultSubtitleLanguage); return(true); } catch (Exception e) { BaseConfig.MyAnimeLog.Write("ResumeOrPlay: {0}", e.ToString()); return(false); } }
protected override void OnShowContextMenu() { GUIListItem selectedItem = this.Facade.SelectedListItem; if (selectedItem == null) { return; } var selectedEpisode = selectedItem.TVTag as TraktEpisode; if (selectedEpisode == null) { return; } IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(GUIUtils.PluginName()); GUIListItem listItem = null; listItem = new GUIListItem(Translation.Trailers + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Trailers; if (selectedEpisode.Watched) { listItem = new GUIListItem(Translation.MarkAsUnWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsUnWatched; } else { listItem = new GUIListItem(Translation.MarkAsWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsWatched; } if (selectedEpisode.InCollection) { listItem = new GUIListItem(Translation.RemoveFromLibrary); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromLibrary; } else { listItem = new GUIListItem(Translation.AddToLibrary); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToLibrary; } if (selectedEpisode.InWatchList) { listItem = new GUIListItem(Translation.RemoveFromWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList; } else { listItem = new GUIListItem(Translation.AddEpisodeToWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToWatchList; } // Add to Custom List listItem = new GUIListItem(Translation.AddToList + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToList; // Rate listItem = new GUIListItem(Translation.Rate + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Rate; // Shouts listItem = new GUIListItem(Translation.Shouts + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Shouts; // Change Layout listItem = new GUIListItem(Translation.ChangeLayout); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.ChangeLayout; if (TraktHelper.IsMpNZBAvailableAndEnabled) { // Search for show with mpNZB listItem = new GUIListItem(Translation.SearchWithMpNZB); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB; } if (TraktHelper.IsMyTorrentsAvailableAndEnabled) { // Search for show with MyTorrents listItem = new GUIListItem(Translation.SearchTorrent); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchTorrent; } // Show Context Menu dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId < 0) { return; } switch (dlg.SelectedId) { case ((int)ContextMenuItem.Trailers): GUICommon.ShowTVShowTrailersMenu(Show, selectedEpisode); break; case ((int)ContextMenuItem.MarkAsWatched): MarkEpisodeAsWatched(selectedEpisode); selectedEpisode.Watched = true; Facade.SelectedListItem.IsPlayed = true; if (selectedEpisode.Plays == 0) { selectedEpisode.Plays = 1; } OnEpisodeSelected(Facade.SelectedListItem, Facade); selectedEpisode.Images.NotifyPropertyChanged("EpisodeImageFilename"); break; case ((int)ContextMenuItem.MarkAsUnWatched): MarkEpisodeAsUnWatched(selectedEpisode); selectedEpisode.Watched = false; Facade.SelectedListItem.IsPlayed = false; OnEpisodeSelected(Facade.SelectedListItem, Facade); selectedEpisode.Images.NotifyPropertyChanged("EpisodeImageFilename"); break; case ((int)ContextMenuItem.AddToLibrary): AddEpisodeToLibrary(selectedEpisode); selectedEpisode.InCollection = true; OnEpisodeSelected(selectedItem, Facade); selectedEpisode.Images.NotifyPropertyChanged("EpisodeImageFilename"); break; case ((int)ContextMenuItem.RemoveFromLibrary): RemoveEpisodeFromLibrary(selectedEpisode); selectedEpisode.InCollection = false; OnEpisodeSelected(selectedItem, Facade); selectedEpisode.Images.NotifyPropertyChanged("EpisodeImageFilename"); break; case ((int)ContextMenuItem.AddToWatchList): AddEpisodeToWatchList(selectedEpisode); selectedEpisode.InWatchList = true; OnEpisodeSelected(selectedItem, Facade); selectedEpisode.Images.NotifyPropertyChanged("EpisodeImageFilename"); break; case ((int)ContextMenuItem.RemoveFromWatchList): RemoveEpisodeFromWatchList(selectedEpisode); selectedEpisode.InWatchList = false; OnEpisodeSelected(selectedItem, Facade); selectedEpisode.Images.NotifyPropertyChanged("EpisodeImageFilename"); break; case ((int)ContextMenuItem.Rate): RateEpisode(selectedEpisode); OnEpisodeSelected(Facade.SelectedListItem, Facade); selectedEpisode.Images.NotifyPropertyChanged("EpisodeImageFilename"); break; case ((int)ContextMenuItem.AddToList): TraktHelper.AddRemoveEpisodeInUserList(Show.Title, Show.Year.ToString(), selectedEpisode.Season.ToString(), selectedEpisode.Number.ToString(), Show.Tvdb, false); break; case ((int)ContextMenuItem.Shouts): GUIShouts.ShoutType = GUIShouts.ShoutTypeEnum.episode; GUIShouts.EpisodeInfo = new EpisodeShout { TVDbId = Show.Tvdb, IMDbId = Show.Imdb, Title = Show.Title, SeasonIdx = selectedEpisode.Season.ToString(), EpisodeIdx = selectedEpisode.Number.ToString() }; GUIShouts.Fanart = Show.Images.FanartImageFilename; GUIWindowManager.ActivateWindow((int)TraktGUIWindows.Shouts); break; case ((int)ContextMenuItem.ChangeLayout): CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout); break; case ((int)ContextMenuItem.SearchWithMpNZB): string loadingParam = string.Format("search:{0} S{1}E{2}", Show.Title, selectedEpisode.Season.ToString("D2"), selectedEpisode.Number.ToString("D2")); GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam); break; case ((int)ContextMenuItem.SearchTorrent): string loadPar = string.Format("{0} S{1}E{2}", Show.Title, selectedEpisode.Season.ToString("D2"), selectedEpisode.Number.ToString("D2")); GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar); break; default: break; } base.OnShowContextMenu(); }
protected override void OnShowContextMenu() { GUIListItem selectedItem = this.Facade.SelectedListItem; if (selectedItem == null) { return; } TraktWatchListMovie selectedMovie = (TraktWatchListMovie)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; // only allow removal if viewing your own watch list if (CurrentUser == TraktSettings.Username) { listItem = new GUIListItem(Translation.RemoveFromWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList; } else if (!selectedMovie.InWatchList) { // viewing someone else's watch list and not in yours listItem = new GUIListItem(Translation.AddToWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToWatchList; } // Add to Custom List listItem = new GUIListItem(Translation.AddToList + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToList; // Mark As Watched if (!selectedMovie.Watched) { listItem = new GUIListItem(Translation.MarkAsWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsWatched; } // Mark As UnWatched if (selectedMovie.Watched) { listItem = new GUIListItem(Translation.MarkAsUnWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsUnWatched; } // Add to Library // Don't allow if it will be removed again on next sync // movie could be part of a DVD collection if (!selectedMovie.InCollection && !TraktSettings.KeepTraktLibraryClean) { listItem = new GUIListItem(Translation.AddToLibrary); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToLibrary; } if (selectedMovie.InCollection) { listItem = new GUIListItem(Translation.RemoveFromLibrary); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromLibrary; } // Related Movies listItem = new GUIListItem(Translation.RelatedMovies + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Related; // Rate Movie listItem = new GUIListItem(Translation.RateMovie); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Rate; // Shouts listItem = new GUIListItem(Translation.Shouts + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Shouts; if (TraktHelper.IsOnlineVideosAvailableAndEnabled) { // Trailers listItem = new GUIListItem(Translation.Trailers); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Trailers; } // Change Layout listItem = new GUIListItem(Translation.ChangeLayout); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.ChangeLayout; if (!selectedMovie.InCollection && TraktHelper.IsMpNZBAvailableAndEnabled) { // Search for movie with mpNZB listItem = new GUIListItem(Translation.SearchWithMpNZB); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB; } if (!selectedMovie.InCollection && TraktHelper.IsMyTorrentsAvailableAndEnabled) { // Search for movie with MyTorrents listItem = new GUIListItem(Translation.SearchTorrent); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchTorrent; } // Show Context Menu dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId < 0) { return; } switch (dlg.SelectedId) { case ((int)ContextMenuItem.MarkAsWatched): MarkMovieAsWatched(selectedMovie); if (CurrentUser != TraktSettings.Username) { if (selectedMovie.Plays == 0) { selectedMovie.Plays = 1; } selectedMovie.Watched = true; selectedItem.IsPlayed = true; OnMovieSelected(selectedItem, Facade); selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename"); GUIWatchListMovies.ClearCache(TraktSettings.Username); } else { // when marking a movie as seen via API, it will remove from watch list // we should do the same in GUI PreviousSelectedIndex = this.Facade.SelectedListItemIndex; if (_WatchListMovies.Count() >= 1) { // remove from list var moviesToExcept = new List <TraktWatchListMovie>(); moviesToExcept.Add(selectedMovie); _WatchListMovies = WatchListMovies.Except(moviesToExcept); userWatchList[CurrentUser] = _WatchListMovies; LoadWatchListMovies(); } else { // no more movies left ClearProperties(); GUIControl.ClearControl(GetID, Facade.GetID); _WatchListMovies = null; userWatchList.Remove(CurrentUser); // notify and exit GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoMovieWatchList); GUIWindowManager.ShowPreviousWindow(); return; } } break; case ((int)ContextMenuItem.MarkAsUnWatched): MarkMovieAsUnWatched(selectedMovie); selectedMovie.Watched = false; selectedItem.IsPlayed = false; OnMovieSelected(selectedItem, Facade); selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename"); break; case ((int)ContextMenuItem.AddToWatchList): AddMovieToWatchList(selectedMovie); selectedMovie.InWatchList = true; OnMovieSelected(selectedItem, Facade); selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename"); GUIWatchListMovies.ClearCache(TraktSettings.Username); break; case ((int)ContextMenuItem.RemoveFromWatchList): PreviousSelectedIndex = this.Facade.SelectedListItemIndex; RemoveMovieFromWatchList(selectedMovie); if (_WatchListMovies.Count() >= 1) { // remove from list var moviesToExcept = new List <TraktWatchListMovie>(); moviesToExcept.Add(selectedMovie); _WatchListMovies = WatchListMovies.Except(moviesToExcept); userWatchList[CurrentUser] = _WatchListMovies; LoadWatchListMovies(); } else { // no more movies left ClearProperties(); GUIControl.ClearControl(GetID, Facade.GetID); _WatchListMovies = null; userWatchList.Remove(CurrentUser); // notify and exit GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoMovieWatchList); GUIWindowManager.ShowPreviousWindow(); return; } break; case ((int)ContextMenuItem.AddToList): TraktHelper.AddRemoveMovieInUserList(selectedMovie.Title, selectedMovie.Year, selectedMovie.IMDBID, false); break; case ((int)ContextMenuItem.Trailers): GUICommon.ShowMovieTrailersMenu(selectedMovie); break; case ((int)ContextMenuItem.AddToLibrary): AddMovieToLibrary(selectedMovie); selectedMovie.InCollection = true; OnMovieSelected(selectedItem, Facade); selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename"); if (CurrentUser != TraktSettings.Username) { GUIWatchListMovies.ClearCache(TraktSettings.Username); } break; case ((int)ContextMenuItem.RemoveFromLibrary): RemoveMovieFromLibrary(selectedMovie); selectedMovie.InCollection = false; OnMovieSelected(selectedItem, Facade); selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename"); if (CurrentUser != TraktSettings.Username) { GUIWatchListMovies.ClearCache(TraktSettings.Username); } break; case ((int)ContextMenuItem.Related): RelatedMovie relatedMovie = new RelatedMovie(); relatedMovie.IMDbId = selectedMovie.IMDBID; relatedMovie.Title = selectedMovie.Title; GUIRelatedMovies.relatedMovie = relatedMovie; GUIWindowManager.ActivateWindow((int)TraktGUIWindows.RelatedMovies); break; case ((int)ContextMenuItem.Rate): GUICommon.RateMovie(selectedMovie); OnMovieSelected(selectedItem, Facade); selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename"); if (CurrentUser != TraktSettings.Username) { GUIWatchListMovies.ClearCache(TraktSettings.Username); } break; case ((int)ContextMenuItem.Shouts): GUIShouts.ShoutType = GUIShouts.ShoutTypeEnum.movie; GUIShouts.MovieInfo = new MovieShout { IMDbId = selectedMovie.IMDBID, TMDbId = selectedMovie.TMDBID, Title = selectedMovie.Title, Year = selectedMovie.Year }; GUIShouts.Fanart = selectedMovie.Images.FanartImageFilename; GUIWindowManager.ActivateWindow((int)TraktGUIWindows.Shouts); break; case ((int)ContextMenuItem.ChangeLayout): CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout); break; case ((int)ContextMenuItem.SearchWithMpNZB): string loadingParam = string.Format("search:{0}", selectedMovie.Title); GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam); break; case ((int)ContextMenuItem.SearchTorrent): string loadPar = selectedMovie.Title; GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar); break; default: break; } base.OnShowContextMenu(); }
protected override void OnShowContextMenu() { if (GUIBackgroundTask.Instance.IsBusy) { return; } var selectedItem = this.Facade.SelectedListItem as GUIMovieListItem; if (selectedItem == null) { return; } var selectedMovie = selectedItem.TVTag as TraktMovieSummary; if (selectedMovie == null) { return; } IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(GUIUtils.PluginName()); GUIListItem listItem = null; // Hide/Show Watched items listItem = new GUIListItem(HideWatched ? Translation.ShowWatched : Translation.HideWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.HideShowWatched; // Mark As Watched if (!selectedMovie.IsWatched()) { listItem = new GUIListItem(Translation.MarkAsWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsWatched; } // Mark As UnWatched if (selectedMovie.IsWatched()) { listItem = new GUIListItem(Translation.MarkAsUnWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsUnWatched; } // Add/Remove Watchlist if (!selectedMovie.IsWatchlisted()) { listItem = new GUIListItem(Translation.AddToWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToWatchList; } else { listItem = new GUIListItem(Translation.RemoveFromWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList; } // Add to Custom list listItem = new GUIListItem(Translation.AddToList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToList; // Add to Library // Don't allow if it will be removed again on next sync // movie could be part of a DVD collection if (!selectedMovie.IsCollected() && !TraktSettings.KeepTraktLibraryClean) { listItem = new GUIListItem(Translation.AddToLibrary); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToLibrary; } if (selectedMovie.IsCollected()) { listItem = new GUIListItem(Translation.RemoveFromLibrary); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromLibrary; } // Related Movies listItem = new GUIListItem(Translation.RelatedMovies); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Related; // Rate Movie listItem = new GUIListItem(Translation.RateMovie); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Rate; // Shouts listItem = new GUIListItem(Translation.Comments); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Shouts; // 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; // Trailers if (TraktHelper.IsTrailersAvailableAndEnabled) { listItem = new GUIListItem(Translation.Trailers); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Trailers; } // Change Layout listItem = new GUIListItem(Translation.ChangeLayout); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.ChangeLayout; if (!selectedMovie.IsCollected() && TraktHelper.IsMpNZBAvailableAndEnabled) { // Search for movie with mpNZB listItem = new GUIListItem(Translation.SearchWithMpNZB); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB; } if (!selectedMovie.IsCollected() && TraktHelper.IsMyTorrentsAvailableAndEnabled) { // Search for movie with MyTorrents listItem = new GUIListItem(Translation.SearchTorrent); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchTorrent; } // Show Context Menu dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId < 0) { return; } switch (dlg.SelectedId) { case ((int)ContextMenuItem.HideShowWatched): HideWatched = !HideWatched; if (hideWatchedButton != null) { hideWatchedButton.Selected = HideWatched; } dictRelatedMovies.Remove(relatedMovie.Slug); LoadRelatedMovies(); break; case ((int)ContextMenuItem.MarkAsWatched): TraktHelper.AddMovieToWatchHistory(selectedMovie); if (!HideWatched) { selectedItem.IsPlayed = true; OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); } else { dictRelatedMovies.Remove(relatedMovie.Slug); LoadRelatedMovies(); } break; case ((int)ContextMenuItem.MarkAsUnWatched): TraktHelper.RemoveMovieFromWatchHistory(selectedMovie); selectedItem.IsPlayed = false; OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.AddToWatchList): TraktHelper.AddMovieToWatchList(selectedMovie, true); OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.RemoveFromWatchList): TraktHelper.RemoveMovieFromWatchList(selectedMovie, true); OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.AddToList): TraktHelper.AddRemoveMovieInUserList(selectedMovie, false); break; case ((int)ContextMenuItem.AddToLibrary): TraktHelper.AddMovieToCollection(selectedMovie); OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.RemoveFromLibrary): TraktHelper.RemoveMovieFromCollection(selectedMovie); OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.Related): var relMovie = new RelatedMovie { Title = selectedMovie.Title, Year = selectedMovie.Year, TraktId = selectedMovie.Ids.Trakt, TmdbId = selectedMovie.Ids.Tmdb, ImdbId = selectedMovie.Ids.Imdb }; relatedMovie = relMovie; GUIUtils.SetProperty("#Trakt.Related.Movie", relMovie.Title); LoadRelatedMovies(); RelationChanged = true; break; case ((int)ContextMenuItem.Rate): GUICommon.RateMovie(selectedMovie); OnMovieSelected(selectedItem, Facade); (Facade.SelectedListItem as GUIMovieListItem).Images.NotifyPropertyChanged("Poster"); break; case ((int)ContextMenuItem.Shouts): TraktHelper.ShowMovieShouts(selectedMovie); break; case ((int)ContextMenuItem.Cast): GUICreditsMovie.Movie = selectedMovie; GUICreditsMovie.Type = GUICreditsMovie.CreditType.Cast; GUICreditsMovie.Fanart = TmdbCache.GetMovieBackdropFilename(selectedItem.Images.MovieImages); GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsMovie); break; case ((int)ContextMenuItem.Crew): GUICreditsMovie.Movie = selectedMovie; GUICreditsMovie.Type = GUICreditsMovie.CreditType.Crew; GUICreditsMovie.Fanart = TmdbCache.GetMovieBackdropFilename(selectedItem.Images.MovieImages); GUIWindowManager.ActivateWindow((int)TraktGUIWindows.CreditsMovie); break; case ((int)ContextMenuItem.Trailers): GUICommon.ShowMovieTrailersMenu(selectedMovie); break; case ((int)ContextMenuItem.ChangeLayout): CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout, PreviousSelectedIndex); break; case ((int)ContextMenuItem.SearchWithMpNZB): string loadingParam = string.Format("search:{0}", selectedMovie.Title); GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam); break; case ((int)ContextMenuItem.SearchTorrent): string loadPar = selectedMovie.Title; GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar); break; default: break; } base.OnShowContextMenu(); }
protected override void OnShowContextMenu() { try { GUIListItem currentitem = this.m_Facade.SelectedListItem; if (currentitem == null || !(currentitem.TVTag is TvDB_ImageWideBannerVM)) { return; } TvDB_ImageWideBannerVM selectedBanner = currentitem.TVTag as TvDB_ImageWideBannerVM; IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading("Wide Banner"); bool isDisabled = false; bool isDefault = false; isDisabled = selectedBanner.Enabled == 0 ? true : false; GUIListItem pItem; if (isDisabled) { pItem = new GUIListItem("Enable"); dlg.Add(pItem); } else { pItem = new GUIListItem("Disable"); dlg.Add(pItem); } if (!isDisabled) { if (!selectedBanner.IsImageDefault) { pItem = new GUIListItem("Set as Default"); dlg.Add(pItem); } if (selectedBanner.IsImageDefault) { pItem = new GUIListItem("Remove as Default"); dlg.Add(pItem); } } // lets show it dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId == 1) // enabled/disable { bool endis = isDisabled; JMMServerHelper.EnableDisableWideBanner(endis, selectedBanner, AnimeID); ShowWideBanners(); return; } if (dlg.SelectedId == 2) { bool isdef = !selectedBanner.IsImageDefault; JMMServerHelper.SetDefaultWideBanner(isdef, selectedBanner, AnimeID); ShowWideBanners(); return; } } catch (Exception ex) { BaseConfig.MyAnimeLog.Write("Exception in Wide Banner Chooser Context Menu: " + ex.Message); return; } }
protected override void OnShowContextMenu() { IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(GUIUtils.PluginName()); var episodeItem = Facade.SelectedListItem.TVTag as TraktEpisodeSummary; if (episodeItem == null) { return; } // Create Views Menu Item GUIListItem 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; // Show Season Information listItem = new GUIListItem(Translation.ShowSeasonInfo); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.ShowSeasonInfo; // Related Shows listItem = new GUIListItem(Translation.RelatedShows + "..."); 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 (!episodeItem.Episode.Watched) { listItem = new GUIListItem(Translation.MarkAsWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsWatched; } // Mark As UnWatched if (episodeItem.Episode.Watched) { listItem = new GUIListItem(Translation.MarkAsUnWatched); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.MarkAsUnWatched; } // Add/Remove Show Watch List if (!episodeItem.Show.InWatchList) { listItem = new GUIListItem(Translation.AddShowToWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddShowToWatchList; } else { listItem = new GUIListItem(Translation.RemoveShowFromWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveShowFromWatchList; } // Add/Remove Episode Watch List if (!episodeItem.Episode.InWatchList) { listItem = new GUIListItem(Translation.AddEpisodeToWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddEpisodeToWatchList; } else { listItem = new GUIListItem(Translation.RemoveEpisodeFromWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveEpisodeFromWatchList; } // Add Show to Custom List listItem = new GUIListItem(Translation.AddShowToList + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddShowToList; // Add Episode to Custom List listItem = new GUIListItem(Translation.AddEpisodeToList + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddEpisodeToList; // Shouts listItem = new GUIListItem(Translation.Shouts + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Shouts; // Add/Remove Libary if (!episodeItem.Episode.InCollection) { 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; } if (TraktHelper.IsOnlineVideosAvailableAndEnabled) { listItem = new GUIListItem(Translation.Trailers); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Trailers; } // Watch List Filter if (CurrentCalendar == CalendarType.MyShows) { if (TraktSettings.CalendarHideTVShowsInWatchList) { listItem = new GUIListItem(Translation.ShowTVShowsInWatchlist); } else { listItem = new GUIListItem(Translation.HideTVShowsInWatchlist); } dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.WatchlistFilter; } // 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.ShowSeasonInfo): GUIWindowManager.ActivateWindow((int)TraktGUIWindows.ShowSeasons, episodeItem.Show.ToJSON()); break; case ((int)ContextMenuItem.Related): TraktHelper.ShowRelatedShows(episodeItem.Show); break; case ((int)ContextMenuItem.Shouts): TraktHelper.ShowEpisodeShouts(episodeItem.Show, episodeItem.Episode); break; case ((int)ContextMenuItem.Rate): GUICommon.RateEpisode(episodeItem.Show, episodeItem.Episode); OnEpisodeSelected(Facade.SelectedListItem, Facade); (Facade.SelectedListItem as GUIEpisodeListItem).Images.NotifyPropertyChanged("Screen"); break; case ((int)ContextMenuItem.MarkAsWatched): TraktHelper.MarkEpisodeAsWatched(episodeItem.Show, episodeItem.Episode); episodeItem.Episode.Watched = true; Facade.SelectedListItem.IsPlayed = true; if (episodeItem.Episode.Plays == 0) { episodeItem.Episode.Plays = 1; } OnEpisodeSelected(Facade.SelectedListItem, Facade); (Facade.SelectedListItem as GUIEpisodeListItem).Images.NotifyPropertyChanged("Screen"); break; case ((int)ContextMenuItem.MarkAsUnWatched): TraktHelper.MarkEpisodeAsUnWatched(episodeItem.Show, episodeItem.Episode); episodeItem.Episode.Watched = false; Facade.SelectedListItem.IsPlayed = false; OnEpisodeSelected(Facade.SelectedListItem, Facade); (Facade.SelectedListItem as GUIEpisodeListItem).Images.NotifyPropertyChanged("Screen"); break; case ((int)ContextMenuItem.AddShowToWatchList): TraktHelper.AddShowToWatchList(episodeItem.Show); episodeItem.Show.InWatchList = true; OnEpisodeSelected(Facade.SelectedListItem, Facade); GUIWatchListShows.ClearCache(TraktSettings.Username); break; case ((int)ContextMenuItem.AddEpisodeToWatchList): TraktHelper.AddEpisodeToWatchList(episodeItem.Show, episodeItem.Episode); episodeItem.Episode.InWatchList = true; OnEpisodeSelected(Facade.SelectedListItem, Facade); (Facade.SelectedListItem as GUIEpisodeListItem).Images.NotifyPropertyChanged("Screen"); GUIWatchListShows.ClearCache(TraktSettings.Username); break; case ((int)ContextMenuItem.RemoveShowFromWatchList): TraktHelper.RemoveShowFromWatchList(episodeItem.Show); episodeItem.Show.InWatchList = false; OnEpisodeSelected(Facade.SelectedListItem, Facade); GUIWatchListShows.ClearCache(TraktSettings.Username); break; case ((int)ContextMenuItem.RemoveEpisodeFromWatchList): TraktHelper.RemoveEpisodeFromWatchList(episodeItem.Show, episodeItem.Episode); episodeItem.Episode.InWatchList = false; OnEpisodeSelected(Facade.SelectedListItem, Facade); (Facade.SelectedListItem as GUIEpisodeListItem).Images.NotifyPropertyChanged("Screen"); GUIWatchListShows.ClearCache(TraktSettings.Username); break; case ((int)ContextMenuItem.AddEpisodeToList): TraktHelper.AddRemoveEpisodeInUserList(episodeItem.Show.Title, episodeItem.Show.Year.ToString(), episodeItem.Episode.Season.ToString(), episodeItem.Episode.Number.ToString(), episodeItem.Show.Tvdb, false); break; case ((int)ContextMenuItem.AddShowToList): TraktHelper.AddRemoveShowInUserList(episodeItem.Show.Title, episodeItem.Show.Year.ToString(), episodeItem.Show.Tvdb, false); break; case ((int)ContextMenuItem.AddToLibrary): TraktHelper.AddEpisodeToLibrary(episodeItem.Show, episodeItem.Episode); episodeItem.Episode.InCollection = true; OnEpisodeSelected(Facade.SelectedListItem, Facade); (Facade.SelectedListItem as GUIEpisodeListItem).Images.NotifyPropertyChanged("Screen"); break; case ((int)ContextMenuItem.RemoveFromLibrary): TraktHelper.RemoveEpisodeFromLibrary(episodeItem.Show, episodeItem.Episode); episodeItem.Episode.InCollection = false; OnEpisodeSelected(Facade.SelectedListItem, Facade); (Facade.SelectedListItem as GUIEpisodeListItem).Images.NotifyPropertyChanged("Screen"); break; case ((int)ContextMenuItem.Trailers): if (episodeItem != null) { GUICommon.ShowTVShowTrailersMenu(episodeItem.Show, episodeItem.Episode); } break; case ((int)ContextMenuItem.WatchlistFilter): TraktSettings.CalendarHideTVShowsInWatchList = !TraktSettings.CalendarHideTVShowsInWatchList; SetHideWatchlisted(); LoadCalendar(); break; default: break; } base.OnShowContextMenu(); }
protected override void OnShowContextMenu() { GUIListItem selectedItem = this.Facade.SelectedListItem; if (selectedItem == null) { return; } TraktWatchListShow selectedShow = (TraktWatchListShow)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; // Show Season Information listItem = new GUIListItem(Translation.ShowSeasonInfo); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.ShowSeasonInfo; if (CurrentUser == TraktSettings.Username) { listItem = new GUIListItem(Translation.RemoveFromWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList; } else if (!selectedShow.InWatchList) { // viewing someone else's watch list and not in yours listItem = new GUIListItem(Translation.AddToWatchList); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToWatchList; } // Add to Custom List listItem = new GUIListItem(Translation.AddToList + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.AddToList; if (TraktHelper.IsOnlineVideosAvailableAndEnabled) { listItem = new GUIListItem(Translation.Trailers); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Trailers; } // Related Shows listItem = new GUIListItem(Translation.RelatedShows + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Related; // Rate Show listItem = new GUIListItem(Translation.RateShow); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Rate; // Shouts listItem = new GUIListItem(Translation.Shouts + "..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.Shouts; // Change Layout listItem = new GUIListItem(Translation.ChangeLayout); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.ChangeLayout; if (TraktHelper.IsMpNZBAvailableAndEnabled) { // Search for show with mpNZB listItem = new GUIListItem(Translation.SearchWithMpNZB); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB; } if (TraktHelper.IsMyTorrentsAvailableAndEnabled) { // Search for show with MyTorrents listItem = new GUIListItem(Translation.SearchTorrent); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.SearchTorrent; } // Show Context Menu dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId < 0) { return; } switch (dlg.SelectedId) { case ((int)ContextMenuItem.ShowSeasonInfo): GUIWindowManager.ActivateWindow((int)TraktGUIWindows.ShowSeasons, selectedShow.ToJSON()); break; case ((int)ContextMenuItem.AddToWatchList): AddShowToWatchList(selectedShow); selectedShow.InWatchList = true; OnShowSelected(selectedItem, Facade); selectedShow.Images.NotifyPropertyChanged("PosterImageFilename"); GUIWatchListShows.ClearCache(TraktSettings.Username); break; case ((int)ContextMenuItem.RemoveFromWatchList): PreviousSelectedIndex = this.Facade.SelectedListItemIndex; RemoveShowFromWatchList(selectedShow); if (_WatchListShows.Count() >= 1) { // remove from list var showsToExcept = new List <TraktWatchListShow>(); showsToExcept.Add(selectedShow); _WatchListShows = WatchListShows.Except(showsToExcept); userWatchList[CurrentUser] = _WatchListShows; LoadWatchListShows(); } else { // no more shows left ClearProperties(); GUIControl.ClearControl(GetID, Facade.GetID); _WatchListShows = null; userWatchList.Remove(CurrentUser); // notify and exit GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoShowWatchList); GUIWindowManager.ShowPreviousWindow(); return; } break; case ((int)ContextMenuItem.AddToList): TraktHelper.AddRemoveShowInUserList(selectedShow.Title, selectedShow.Year.ToString(), selectedShow.Tvdb, false); break; case ((int)ContextMenuItem.Related): RelatedShow relatedShow = new RelatedShow(); relatedShow.Title = selectedShow.Title; relatedShow.TVDbId = selectedShow.Tvdb; GUIRelatedShows.relatedShow = relatedShow; GUIWindowManager.ActivateWindow((int)TraktGUIWindows.RelatedShows); break; case ((int)ContextMenuItem.Rate): GUICommon.RateShow(selectedShow); OnShowSelected(selectedItem, Facade); selectedShow.Images.NotifyPropertyChanged("PosterImageFilename"); if (CurrentUser != TraktSettings.Username) { GUIWatchListShows.ClearCache(TraktSettings.Username); } break; case ((int)ContextMenuItem.Shouts): GUIShouts.ShoutType = GUIShouts.ShoutTypeEnum.show; GUIShouts.ShowInfo = new ShowShout { IMDbId = selectedShow.Imdb, TVDbId = selectedShow.Tvdb, Title = selectedShow.Title }; GUIShouts.Fanart = selectedShow.Images.FanartImageFilename; GUIWindowManager.ActivateWindow((int)TraktGUIWindows.Shouts); break; case ((int)ContextMenuItem.Trailers): GUICommon.ShowTVShowTrailersMenu(selectedShow); break; case ((int)ContextMenuItem.ChangeLayout): CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout); break; case ((int)ContextMenuItem.SearchWithMpNZB): string loadingParam = string.Format("search:{0}", selectedShow.Title); GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam); break; case ((int)ContextMenuItem.SearchTorrent): string loadPar = selectedShow.Title; GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar); break; default: break; } base.OnShowContextMenu(); }
protected override void OnShowContextMenu() { GUIListItem selectedItem = this.FacadeActors.SelectedListItem; if (selectedItem == null) { return; } IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); dlg.Reset(); dlg.SetHeading(Translation.Actors); GUIListItem listItem = null; // Trakt: Search for Actor if (Helper.IsTraktAvailableAndEnabled) { listItem = new GUIListItem(Translation.Biography); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.biography; } // MovingPictures: Search for Actor in Movies if (Helper.IsMovingPicturesAvailableAndEnabled) { listItem = new GUIListItem(Translation.SearchActorInMovies); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.searchmovie; } listItem = new GUIListItem(Translation.ChangeLayout + " ..."); dlg.Add(listItem); listItem.ItemId = (int)ContextMenuItem.layout; // Show Context Menu dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedId < 0) { return; } switch (dlg.SelectedId) { case ((int)ContextMenuItem.layout): ShowLayoutsMenu(); break; case ((int)ContextMenuItem.searchmovie): DBActor actor = (selectedItem as GUIActorListItem).Item as DBActor; string searchObj = string.Format("searchcast:{0}", actor.Name); GUIWindowManager.ActivateWindow(96742, searchObj); break; // trakt actor search case ((int)ContextMenuItem.biography): actor = (selectedItem as GUIActorListItem).Item as DBActor; GUIWindowManager.ActivateWindow(874005, actor.Name); break; } base.OnShowContextMenu(); }