protected override void OnShowContextMenu() { GUIListItem currentitem = this.m_Facade.SelectedListItem; if (currentitem == null) { return; } if (currentitem.TVTag.GetType() == typeof(AnimeEpisodeVM)) { AnimeEpisodeVM ep = currentitem.TVTag as AnimeEpisodeVM; if (ep != null) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(ep.EpisodeNumberAndName); dlg.Add("Mark as Watched"); dlg.Add("Play Previous Episode"); dlg.Add("Go To Episode List"); dlg.Add("View Series Info"); dlg.DoModal(GUIWindowManager.ActiveWindow); switch (dlg.SelectedLabel) { case 0: ep.ToggleWatchedStatus(true); LoadData(); break; case 1: if (ep.AnimeSeries == null) { return; } JMMServerBinary.Contract_AnimeEpisode contract = JMMServerVM.Instance.clientBinaryHTTP.GetPreviousEpisodeForUnwatched(ep.AnimeSeries.AnimeSeriesID.Value, JMMServerVM.Instance.CurrentUser.JMMUserID); if (contract == null) { Utils.DialogMsg("Error", "Previous episode not found"); return; } AnimeEpisodeVM epPrev = new AnimeEpisodeVM(contract); MainWindow.vidHandler.ResumeOrPlay(epPrev); break; case 2: if (ep.AnimeSeries == null) { return; } MainWindow.curGroupFilter = GroupFilterHelper.AllGroupsFilter; // find the group for this series AnimeGroupVM grp = JMMServerHelper.GetGroup(ep.AnimeSeries.AnimeGroupID); if (grp == null) { BaseConfig.MyAnimeLog.Write("Group not found"); return; } MainWindow.curAnimeGroup = grp; MainWindow.curAnimeGroupViewed = grp; MainWindow.curAnimeSeries = ep.AnimeSeries; bool foundEpType = false; foreach (AnimeEpisodeTypeVM anEpType in ep.AnimeSeries.EpisodeTypesToDisplay) { if (anEpType.EpisodeType == enEpisodeType.Episode) { MainWindow.curAnimeEpisodeType = anEpType; foundEpType = true; break; } } if (!foundEpType) { return; } MainWindow.listLevel = Listlevel.Episode; GUIWindowManager.ActivateWindow(Constants.WindowIDs.MAIN, false); break; case 3: if (ep.AnimeSeries == null) { return; } MainWindow.GlobalSeriesID = ep.AnimeSeries.AnimeSeriesID.Value; GUIWindowManager.ActivateWindow(Constants.WindowIDs.ANIMEINFO, false); break; } } } }
protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) { if (MA3WindowManager.HandleWindowChangeButton(control)) { return; } if (btnAddCategory != null && control == btnAddCategory) { string cat = Utils.PromptSelectCategory(""); if (!string.IsNullOrEmpty(cat)) { if (!string.IsNullOrEmpty(MainWindow.RandomWindow_SeriesCategories)) { MainWindow.RandomWindow_SeriesCategories += ", "; } MainWindow.RandomWindow_SeriesCategories += cat; SetDisplayDetails(); } } if (btnEpisodeAddCategory != null && control == btnEpisodeAddCategory) { string cat = Utils.PromptSelectCategory(""); if (!string.IsNullOrEmpty(cat)) { if (!string.IsNullOrEmpty(MainWindow.RandomWindow_EpisodeCategories)) { MainWindow.RandomWindow_EpisodeCategories += ", "; } MainWindow.RandomWindow_EpisodeCategories += cat; SetDisplayDetails(); } } if (btnClearcategories != null && control == btnClearcategories) { MainWindow.RandomWindow_SeriesCategories = ""; SetDisplayDetails(); } if (btnEpisodeClearcategories != null && control == btnEpisodeClearcategories) { MainWindow.RandomWindow_EpisodeCategories = ""; SetDisplayDetails(); } if (btnAllAnycategories != null && control == btnAllAnycategories) { MainWindow.RandomWindow_SeriesAllCategories = !MainWindow.RandomWindow_SeriesAllCategories; SetDisplayDetails(); } if (btnEpisodeAllAnycategories != null && control == btnEpisodeAllAnycategories) { MainWindow.RandomWindow_EpisodeAllCategories = !MainWindow.RandomWindow_EpisodeAllCategories; SetDisplayDetails(); } if (btnRandom != null && control == btnRandom) { if (togWatched != null) { MainWindow.RandomWindow_SeriesWatched = togWatched.Selected; } if (togUnwatched != null) { MainWindow.RandomWindow_SeriesUnwatched = togUnwatched.Selected; } if (togPartiallyWatched != null) { MainWindow.RandomWindow_SeriesPartiallyWatched = togPartiallyWatched.Selected; } if (togCompleteOnly != null) { MainWindow.RandomWindow_SeriesOnlyComplete = togCompleteOnly.Selected; } if (togEpisodeUnwatched != null) { MainWindow.RandomWindow_EpisodeUnwatched = togEpisodeUnwatched.Selected; } if (togEpisodeWatched != null) { MainWindow.RandomWindow_EpisodeWatched = togEpisodeWatched.Selected; } MainWindow.RandomWindow_CurrentEpisode = null; MainWindow.RandomWindow_CurrentSeries = null; this.btnRandom.IsFocused = true; LoadData(); } if (btnSwitchSeries != null && control == btnSwitchSeries) { this.btnSwitchSeries.IsFocused = false; this.btnRandom.IsFocused = true; MainWindow.RandomWindow_RandomType = RandomObjectType.Series; LoadData(); } if (btnSwitchEpisode != null && control == btnSwitchEpisode) { this.btnSwitchEpisode.IsFocused = false; this.btnRandom.IsFocused = true; MainWindow.RandomWindow_RandomType = RandomObjectType.Episode; LoadData(); } if (btnPlayEpisode != null && control == btnPlayEpisode) { if (MainWindow.RandomWindow_CurrentEpisode == null) { return; } MainWindow.vidHandler.ResumeOrPlay(MainWindow.RandomWindow_CurrentEpisode); } if (btnEpisodeList != null && control == btnEpisodeList) { if (MainWindow.RandomWindow_CurrentSeries == null) { return; } MainWindow.curGroupFilter = GroupFilterHelper.AllGroupsFilter; // find the group for this series AnimeGroupVM grp = JMMServerHelper.GetGroup(MainWindow.RandomWindow_CurrentSeries.AnimeGroupID); if (grp == null) { BaseConfig.MyAnimeLog.Write("Group not found"); return; } MainWindow.curAnimeGroup = grp; MainWindow.curAnimeGroupViewed = grp; MainWindow.curAnimeSeries = MainWindow.RandomWindow_CurrentSeries; bool foundEpType = false; foreach (AnimeEpisodeTypeVM anEpType in MainWindow.RandomWindow_CurrentSeries.EpisodeTypesToDisplay) { if (anEpType.EpisodeType == enEpisodeType.Episode) { MainWindow.curAnimeEpisodeType = anEpType; foundEpType = true; break; } } if (!foundEpType) { return; } MainWindow.listLevel = Listlevel.Episode; GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(Constants.WindowIDs.MAIN, false); return; } base.OnClicked(controlId, control, actionType); }