Ejemplo n.º 1
0
        public void Init(RandomSeriesEpisodeLevel levelType, object levelObject)
        {
            LevelType   = levelType;
            LevelObject = levelObject;

            PopulateTags();
        }
Ejemplo n.º 2
0
        public void Init(RandomSeriesEpisodeLevel levelType, object levelObject)
        {
            LevelType = levelType;
            LevelObject = levelObject;

            PopulateTags();
        }
Ejemplo n.º 3
0
        private bool ShowContextMenuSeries(string previousMenu)
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
            if (currentitem == null)
                return true;

            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
            if (dlg == null)
                return true;

            AnimeSeriesVM ser = currentitem.TVTag as AnimeSeriesVM;
            if (ser == null)
                return true;

            //keep showing the dialog until the user closes it
            int selectedLabel = 0;
            string currentMenu = ser.SeriesName;
            while (true)
            {
                dlg.Reset();
                dlg.SetHeading(currentMenu);

                if (previousMenu != string.Empty)
                    dlg.Add("<<< " + previousMenu);
                dlg.Add("Series Information");
                dlg.Add("Mark all as watched");
                dlg.Add("Mark all as unwatched");
                dlg.Add("Databases >>>");
                dlg.Add("Images >>>");
                dlg.Add("Edit Series >>>");
                dlg.Add("Random Episode");
                dlg.Add("Post-processing >>>");

                dlg.SelectedLabel = selectedLabel;
                dlg.DoModal(GUIWindowManager.ActiveWindow);
                selectedLabel = dlg.SelectedLabel;

                int selection = selectedLabel + ((previousMenu == string.Empty) ? 1 : 0);
                switch (selection)
                {
                    case 0:
                        //show previous
                        return true;
                    case 1:
                        ShowAnimeInfoWindow();
                        return false;
                    case 2: // Mark ALL as Watched
                        {
                            JMMServerHelper.SetWatchedStatusOnSeries(true, int.MaxValue, ser.AnimeSeriesID.Value);

                            JMMServerBinary.Contract_AnimeSeries contract = JMMServerVM.Instance.clientBinaryHTTP.GetSeries(ser.AnimeSeriesID.Value,
                                JMMServerVM.Instance.CurrentUser.JMMUserID);
                            if (contract != null)
                            {
                                AnimeSeriesVM serTemp = new AnimeSeriesVM(contract);
                                Utils.PromptToRateSeriesOnCompletion(serTemp);
                            }

                            LoadFacade();
                            return false;
                        }

                    case 3: // Mark ALL as Unwatched
                        {
                            JMMServerHelper.SetWatchedStatusOnSeries(false, int.MaxValue, ser.AnimeSeriesID.Value);
                            LoadFacade();
                            return false;
                        }
                    case 4:
                        if (!ShowContextMenuDatabases(ser, currentMenu))
                            return false;
                        break;
                    case 5:
                        if (!ShowContextMenuImages(currentMenu))
                            return false;
                        break;
                    case 6:
                        if (!ShowContextMenuSeriesEdit(currentMenu))
                            return false;
                        break;
                    case 7:
                        RandomWindow_CurrentEpisode = null;
                        RandomWindow_CurrentSeries = null;

                        RandomWindow_LevelObject = ser;
                        RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.Series;
                        RandomWindow_RandomType = RandomObjectType.Episode;

                        GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
                        return false;

                    case 8:
                        if (!ShowContextMenuPostProcessing(currentMenu))
                            return false;
                        break;

                    default:
                        //close menu
                        return false;
                }
            }
        }
Ejemplo n.º 4
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if (actionType == MediaPortal.GUI.Library.Action.ActionType.ACTION_MOUSE_DOUBLECLICK)
            {
                OnShowContextMenu();
                return;
            }

            if (actionType == MediaPortal.GUI.Library.Action.ActionType.ACTION_PLAY)
            {
                if (MediaPortal.Player.g_Player.Playing == false)
                    BaseConfig.MyAnimeLog.Write("Pressed the play button");
            }

            if (this.btnDisplayOptions != null && control == this.btnDisplayOptions)
            {
                hook.IsEnabled = false;

                ShowDisplayOptionsMenu("");
                btnDisplayOptions.Focus = false;

                Thread.Sleep(100); //make sure key-up's from the context menu aren't cought by the hook
                hook.IsEnabled = true;

                this.btnDisplayOptions.IsFocused = false;

                return;
            }

            if (this.btnWindowUtilities != null && control == this.btnWindowUtilities)
            {
                SetGlobalIDs();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.ADMIN);

                this.btnWindowUtilities.IsFocused = false;

                return;
            }

            if (this.btnWindowCalendar != null && control == this.btnWindowCalendar)
            {
                SetGlobalIDs();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.CALENDAR);
                //GUIWindowManager.ActivateWindow(Constants.WindowIDs.BROWSER);

                this.btnWindowCalendar.IsFocused = false;

                return;
            }

            if (this.btnWindowDownloads != null && control == this.btnWindowDownloads)
            {
                SetGlobalIDs();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.DOWNLOADS);

                this.btnWindowDownloads.IsFocused = false;
                return;
            }

            if (this.btnWindowContinueWatching != null && control == this.btnWindowContinueWatching)
            {
                SetGlobalIDs();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.WATCHING);

                this.btnWindowContinueWatching.IsFocused = false;
                return;
            }

            if (this.btnWindowRecommendations != null && control == this.btnWindowRecommendations)
            {
                SetGlobalIDs();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.RECOMMENDATIONS);

                this.btnWindowRecommendations.IsFocused = false;
                return;
            }

            if (this.btnWindowRandom != null && control == this.btnWindowRandom)
            {

                RandomWindow_LevelObject = GroupFilterHelper.AllGroupsFilter;
                RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.GroupFilter;
                RandomWindow_RandomType = RandomObjectType.Series;

                GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);

                this.btnWindowRandom.IsFocused = false;
                return;
            }

            if (this.btnChangeLayout != null && control == this.btnChangeLayout)
            {
                ShowLayoutMenu("");
                this.btnChangeLayout.IsFocused = false;
                return;
            }

            if (this.btnSwitchUser != null && control == this.btnSwitchUser)
            {
                if (JMMServerVM.Instance.PromptUserLogin())
                {
                    listLevel = Listlevel.GroupFilter;
                    curAnimeEpisode = null;
                    curAnimeGroup = null;
                    curAnimeSeries = null;
                    curGroupFilter = null;

                    // user has logged in, so save to settings so we will log in as the same user next time
                    settings.CurrentJMMUserID = JMMServerVM.Instance.CurrentUser.JMMUserID.ToString();
                    settings.Save();

                    LoadFacade();
                }

                this.btnSwitchUser.IsFocused = false;
                return;
            }

            if (this.btnSettings != null && control == this.btnSettings)
            {
                hook.IsEnabled = false;

                ShowOptionsDisplayMenu("");
                btnDisplayOptions.Focus = false;

                Thread.Sleep(100); //make sure key-up's from the context menu aren't cought by the hook
                hook.IsEnabled = true;

                this.btnSettings.IsFocused = false;

                return;
            }

            try
            {
                if (actionType != MediaPortal.GUI.Library.Action.ActionType.ACTION_SELECT_ITEM) return; // some other events raised onClicked too for some reason?
                if (control == this.m_Facade)
                {
                    UpdateSearchPanel(false);

                    if (this.m_Facade.SelectedListItem == null || this.m_Facade.SelectedListItem.TVTag == null)
                        return;

                    switch (listLevel)
                    {
                        case Listlevel.GroupFilter:
                            curGroupFilter = this.m_Facade.SelectedListItem.TVTag as GroupFilterVM;
                            if (curGroupFilter == null) return;

                            if (curGroupFilter.GroupFilterID.Value == Constants.StaticGF.Predefined)
                            {
                                listLevel = Listlevel.GroupFilterSub;
                                curGroupFilterSub2 = null;
                                curGroupFilterSub = null;
                            }
                            else
                            {
                                listLevel = Listlevel.Group;
                                curGroupFilterSub2 = null;
                                curGroupFilterSub = null;
                            }

                            LoadFacade();
                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.GroupFilterSub:
                            curGroupFilterSub = this.m_Facade.SelectedListItem.TVTag as GroupFilterVM;
                            if (curGroupFilterSub == null) return;

                            curGroupFilterSub2 = null;
                            listLevel = Listlevel.GroupFilterSub2;

                            LoadFacade();
                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.GroupFilterSub2:
                            curGroupFilterSub2 = this.m_Facade.SelectedListItem.TVTag as GroupFilterVM;
                            if (curGroupFilterSub2 == null) return;

                            listLevel = Listlevel.Group;

                            LoadFacade();
                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.Group:
                            curAnimeGroup = this.m_Facade.SelectedListItem.TVTag as AnimeGroupVM;
                            if (curAnimeGroup == null) return;
                            curAnimeGroupViewed = curAnimeGroup;

                            // e.g. if there is only one series for the group, show the episode types
                            // if there is only for episode type for the series show the episodes
                            ShowChildrenLevelForGroup();

                            LoadFacade();
                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.Series:

                            if (this.m_Facade.SelectedListItem.TVTag == null) return;

                            // sub groups
                            if (this.m_Facade.SelectedListItem.TVTag.GetType() == typeof(AnimeGroupVM))
                            {
                                curAnimeGroup = this.m_Facade.SelectedListItem.TVTag as AnimeGroupVM;
                                if (curAnimeGroup == null) return;
                                curAnimeGroupViewed = curAnimeGroup;

                                ShowChildrenLevelForGroup();
                            }
                            else if (this.m_Facade.SelectedListItem.TVTag.GetType() == typeof(AnimeSeriesVM))
                            {
                                curAnimeSeries = this.m_Facade.SelectedListItem.TVTag as AnimeSeriesVM;
                                if (curAnimeSeries == null) return;

                                ShowChildrenLevelForSeries();
                            }

                            LoadFacade();
                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.EpisodeTypes:
                            curAnimeEpisodeType = this.m_Facade.SelectedListItem.TVTag as AnimeEpisodeTypeVM;
                            if (curAnimeEpisodeType == null) return;

                            listLevel = Listlevel.Episode;
                            SetFanartForEpisodes();
                            LoadFacade();

                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.Episode:
                            this.curAnimeEpisode = this.m_Facade.SelectedListItem.TVTag as AnimeEpisodeVM;
                            if (curAnimeEpisode == null) return;

                            BaseConfig.MyAnimeLog.Write("Selected to play: {0}", curAnimeEpisode.EpisodeNumberAndName);
                            vidHandler.ResumeOrPlay(curAnimeEpisode);

                            break;
                    }
                }
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("Error in OnClicked: {0} - {1}", ex.Message, ex.ToString());
            }

            base.OnClicked(controlId, control, actionType);
        }
Ejemplo n.º 5
0
        private bool ShowContextMenuGroupFilter(string previousMenu)
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
            if (currentitem == null)
                return true;

            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
            if (dlg == null)
                return true;

            GroupFilterVM gf = currentitem.TVTag as GroupFilterVM;
            if (gf == null)
                return true;

            int mnuPrev = -1;
            int mnuRandomSeries = -1;
            int mnuRandomEpisode = -1;

            //keep showing the dialog until the user closes it
            int selectedLabel = 0;
            string currentMenu = gf.GroupFilterName;
            while (true)
            {
                int curMenu = -1;

                dlg.Reset();
                dlg.SetHeading(currentMenu);

                if (previousMenu != string.Empty)
                {
                    dlg.Add("<<< " + previousMenu);
                    curMenu++; mnuPrev = curMenu;
                }
                dlg.Add("Random Series");
                curMenu++; mnuRandomSeries = curMenu;

                dlg.Add("Random Episode");
                curMenu++; mnuRandomEpisode = curMenu;

                dlg.SelectedLabel = selectedLabel;
                dlg.DoModal(GUIWindowManager.ActiveWindow);
                selectedLabel = dlg.SelectedLabel;

                if (selectedLabel == mnuPrev) return true;
                if (selectedLabel == mnuRandomSeries)
                {
                    RandomWindow_CurrentEpisode = null;
                    RandomWindow_CurrentSeries = null;

                    RandomWindow_LevelObject = gf;
                    RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.GroupFilter;
                    RandomWindow_RandomType = RandomObjectType.Series;

                    GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);

                    return false;
                }

                if (selectedLabel == mnuRandomEpisode)
                {
                    RandomWindow_CurrentEpisode = null;
                    RandomWindow_CurrentSeries = null;

                    RandomWindow_LevelObject = gf;
                    RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.GroupFilter;
                    RandomWindow_RandomType = RandomObjectType.Episode;

                    GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);

                    return false;
                }

            }
        }
Ejemplo n.º 6
0
        private bool ShowContextMenuGroup(string previousMenu)
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
            if (currentitem == null)
                return true;

            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
            if (dlg == null)
                return true;

            AnimeGroupVM grp = currentitem.TVTag as AnimeGroupVM;
            if (grp == null)
                return true;

            int mnuPrev = -1;
            int mnuFave = -1;
            int mnuWatched = -1;
            int mnuUnwatched = -1;
            int mnuEdit = -1;
            int mnuQuickSort = -1;
            int mnuRemoveQuickSort = -1;
            int mnuDatabases = -1;
            int mnuImages = -1;
            int mnuSeries = -1;
            int mnuRandomSeries = -1;
            int mnuRandomEpisode = -1;
            int mnuPostProcessing = -1;

            //keep showing the dialog until the user closes it
            int selectedLabel = 0;
            string currentMenu = grp.GroupName;
            while (true)
            {
                int curMenu = -1;

                dlg.Reset();
                dlg.SetHeading(currentMenu);

                string faveText = "Add to Favorites";
                if (grp.IsFave == 1)
                    faveText = "Remove from Favorites";

                if (previousMenu != string.Empty)
                {
                    dlg.Add("<<< " + previousMenu);
                    curMenu++; mnuPrev = curMenu;
                }
                dlg.Add(faveText);
                curMenu++; mnuFave = curMenu;

                dlg.Add("Mark ALL as Watched");
                curMenu++; mnuWatched = curMenu;

                dlg.Add("Mark ALL as Unwatched");
                curMenu++; mnuUnwatched = curMenu;

                dlg.Add("Edit Group >>>");
                curMenu++; mnuEdit = curMenu;

                dlg.Add("Quick Sort >>>");
                curMenu++; mnuQuickSort = curMenu;

                if (GroupFilterQuickSorts.ContainsKey(curGroupFilter.GroupFilterID.Value))
                {
                    dlg.Add("Remove Quick Sort");
                    curMenu++; mnuRemoveQuickSort = curMenu;
                }

                if (grp.AllSeries.Count == 1)
                {
                    dlg.Add("Databases >>>");
                    curMenu++; mnuDatabases = curMenu;
                    dlg.Add("Images >>>");
                    curMenu++; mnuImages = curMenu;
                    dlg.Add("Series Information");
                    curMenu++; mnuSeries = curMenu;
                }

                dlg.Add("Random Series");
                curMenu++; mnuRandomSeries = curMenu;

                dlg.Add("Random Episode");
                curMenu++; mnuRandomEpisode = curMenu;

                dlg.Add("Post-processing >>>");
                curMenu++; mnuPostProcessing = curMenu;

                dlg.SelectedLabel = selectedLabel;
                dlg.DoModal(GUIWindowManager.ActiveWindow);
                selectedLabel = dlg.SelectedLabel;

                if (selectedLabel == mnuPrev) return true;
                if (selectedLabel == mnuFave)
                {
                    grp.IsFave = grp.IsFave == 1 ? 0 : 1;
                    grp.Save();

                    EvaluateVisibility();
                    return false;
                }

                if (selectedLabel == mnuWatched)
                {
                    foreach (AnimeSeriesVM ser in grp.AllSeries)
                        JMMServerHelper.SetWatchedStatusOnSeries(true, int.MaxValue, ser.AnimeSeriesID.Value);

                    LoadFacade();
                    return false;
                }

                if (selectedLabel == mnuUnwatched)
                {
                    foreach (AnimeSeriesVM ser in grp.AllSeries)
                        JMMServerHelper.SetWatchedStatusOnSeries(false, int.MaxValue, ser.AnimeSeriesID.Value);

                    LoadFacade();
                    return false;
                }

                if (selectedLabel == mnuEdit)
                {
                    if (!ShowContextMenuGroupEdit(currentMenu))
                        return false;
                }

                if (selectedLabel == mnuQuickSort)
                {
                    string sortType = "";
                    GroupFilterSortDirection sortDirection = GroupFilterSortDirection.Asc;
                    if (GroupFilterQuickSorts.ContainsKey(curGroupFilter.GroupFilterID.Value))
                        sortDirection = GroupFilterQuickSorts[curGroupFilter.GroupFilterID.Value].SortDirection;

                    if (!Utils.DialogSelectGFQuickSort(ref sortType, ref sortDirection, curGroupFilter.GroupFilterName))
                    {
                        if (!GroupFilterQuickSorts.ContainsKey(curGroupFilter.GroupFilterID.Value))
                            GroupFilterQuickSorts[curGroupFilter.GroupFilterID.Value] = new QuickSort();
                        GroupFilterQuickSorts[curGroupFilter.GroupFilterID.Value].SortType = sortType;
                        GroupFilterQuickSorts[curGroupFilter.GroupFilterID.Value].SortDirection = sortDirection;
                        LoadFacade();
                        return false;
                    }
                }

                if (selectedLabel == mnuRemoveQuickSort)
                {
                    GroupFilterQuickSorts.Remove(curGroupFilter.GroupFilterID.Value);
                    LoadFacade();
                    return false;
                }

                if (selectedLabel == mnuDatabases)
                {
                    if (!ShowContextMenuDatabases(grp.AllSeries[0], "Group Menu"))
                        return false;
                }

                if (selectedLabel == mnuImages)
                {
                    if (!ShowContextMenuImages(currentMenu))
                        return false;
                }

                if (selectedLabel == mnuSeries)
                {
                    ShowAnimeInfoWindow();
                    return false;
                }

                if (selectedLabel == mnuRandomSeries)
                {
                    RandomWindow_CurrentEpisode = null;
                    RandomWindow_CurrentSeries = null;

                    RandomWindow_LevelObject = grp;
                    RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.Group;
                    RandomWindow_RandomType = RandomObjectType.Series;

                    GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);

                    return false;
                }

                if (selectedLabel == mnuRandomEpisode)
                {
                    RandomWindow_CurrentEpisode = null;
                    RandomWindow_CurrentSeries = null;

                    RandomWindow_LevelObject = grp;
                    RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.Group;
                    RandomWindow_RandomType = RandomObjectType.Episode;

                    GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);

                    return false;
                }

                if (selectedLabel == mnuPostProcessing)
                {
                    ShowContextMenuPostProcessing(currentMenu);
                    return false;
                }

            }
        }
        private ContextMenuAction ShowContextMenuSeries(string previousMenu)
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
              if (currentitem == null)
            return ContextMenuAction.Exit;

              AnimeSeriesVM ser = currentitem.TVTag as AnimeSeriesVM;
              if (ser == null)
            return ContextMenuAction.Exit;

              ContextMenu cmenu = new ContextMenu(ser.SeriesName, previousmenu: previousMenu);
              cmenu.AddAction(Translation.SeriesInformation, () => ShowAnimeInfoWindow(ser));
              cmenu.AddAction(Translation.MarkAllAsWatched, () =>
              {
            if (ser.AnimeSeriesID.HasValue)
            {
              JMMServerHelper.SetWatchedStatusOnSeries(true, Int32.MaxValue, ser.AnimeSeriesID.Value);
              Contract_AnimeSeries contract = JMMServerVM.Instance.clientBinaryHTTP.GetSeries(ser.AnimeSeriesID.Value, JMMServerVM.Instance.CurrentUser.JMMUserID);
              if (contract != null)
              {
            AnimeSeriesVM serTemp = new AnimeSeriesVM(contract);
            if(serTemp != null)
              Utils.PromptToRateSeriesOnCompletion(serTemp);
              }
              LoadFacade();
            }
              });
              cmenu.AddAction(Translation.MarkAllAsUnwatched, () =>
              {
            if (ser.AnimeSeriesID.HasValue)
            {
              JMMServerHelper.SetWatchedStatusOnSeries(false, Int32.MaxValue, ser.AnimeSeriesID.Value);
              LoadFacade();
            }
              });
              cmenu.AddAction(Translation.RateSeries, () =>
              {
              if (ser == null)
              {
              BaseConfig.MyAnimeLog.Write("Error during rating = series was null!");
              }
              if (ser.AnimeSeriesID.HasValue)
              {
              Utils.PromptToRateSeriesMaually(ser);
              }
              });
              cmenu.Add(Translation.Databases + " ...", () => ShowContextMenuDatabases(ser, ser.SeriesName));
              cmenu.Add(Translation.Images + " ...", () => ShowContextMenuImages(ser.SeriesName));
              cmenu.Add(Translation.EditSeries + " ...", () => ShowContextMenuSeriesEdit(ser.SeriesName));
              // ReSharper disable ImplicitlyCapturedClosure
              cmenu.AddAction(Translation.RandomEpisode, () =>
              // ReSharper restore ImplicitlyCapturedClosure
              {
            RandomWindow_CurrentEpisode = null;
            RandomWindow_CurrentSeries = null;
            RandomWindow_LevelObject = ser;
            RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.Series;
            RandomWindow_RandomType = RandomObjectType.Episode;
            GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
              });
              cmenu.Add(Translation.PostProcessing + " ...", () => ShowContextMenuPostProcessing(ser.SeriesName));
              return cmenu.Show();
        }
        /*
        private bool ShowContextMenuSeriesInfo(string previousMenu)
        {
          GUIListItem currentitem = this.m_Facade.SelectedListItem;
          if (currentitem == null)
        return true;

          GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
          if (dlg == null)
        return true;

          //keep showing the dialog until the user closes it
          int selectedLabel = 0;
          string currentMenu = "Series Information";
          while (true)
          {
        dlg.Reset();
        dlg.SetHeading(currentMenu);

        if (previousMenu != string.Empty)
          dlg.Add("<<< " + previousMenu);
        dlg.Add("Characters/Actors");
        dlg.Add("Related Series");

        dlg.SelectedLabel = selectedLabel;
        dlg.DoModal(GUIWindowManager.ActiveWindow);
        selectedLabel = dlg.SelectedLabel;

        int selection = selectedLabel + ((previousMenu == string.Empty) ? 1 : 0);
        switch (selection)
        {
          case 0:
            //show previous
            return true;
          case 1:
            ShowCharacterWindow();
            return false;
          case 2:
            ShowRelationsWindow();
            return false;
          default:
            //close menu
            return false;
        }
          }
        }
        */
        private ContextMenuAction ShowContextMenuGroupFilter(string previousMenu)
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;
              if (currentitem == null)
            return ContextMenuAction.Exit;

              GroupFilterVM gf = currentitem.TVTag as GroupFilterVM;
              if (gf == null)
            return ContextMenuAction.Exit;

              ContextMenu cmenu = new ContextMenu(gf.GroupFilterName, previousmenu: previousMenu);
              cmenu.AddAction(Translation.RandomSeries, () =>
              {
            RandomWindow_CurrentEpisode = null;
            RandomWindow_CurrentSeries = null;
            RandomWindow_LevelObject = gf;
            RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.GroupFilter;
            RandomWindow_RandomType = RandomObjectType.Series;
            GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
              });
              cmenu.AddAction(Translation.RandomEpisode, () =>
              {
            RandomWindow_CurrentEpisode = null;
            RandomWindow_CurrentSeries = null;
            RandomWindow_LevelObject = gf;
            RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.GroupFilter;
            RandomWindow_RandomType = RandomObjectType.Episode;
            GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
              });
              return cmenu.Show();
        }
        private ContextMenuAction ShowContextMenuGroup(string previousMenu)
        {
            GUIListItem currentitem = m_Facade.SelectedListItem;
              if (currentitem == null)
              return ContextMenuAction.Exit;
              AnimeGroupVM grp = currentitem.TVTag as AnimeGroupVM;
              if (grp == null)
              return ContextMenuAction.Exit;

              ContextMenu cmenu = new ContextMenu(grp.GroupName, previousmenu: previousMenu);

              if (grp.SubGroups.Count == 0)
              {
              cmenu.AddAction(grp.IsFave == 1 ? Translation.RemoveFromFavorites : Translation.AddToFavorites, () =>
              {
                  grp.IsFave = grp.IsFave == 1 ? 0 : 1;
                  grp.Save();
                  EvaluateVisibility();
              });
              }

              cmenu.AddAction(Translation.MarkAllAsWatched, () =>
              {
              foreach (AnimeSeriesVM ser in grp.AllSeries)
              {
                  if (ser.AnimeSeriesID.HasValue)
                      JMMServerHelper.SetWatchedStatusOnSeries(true, Int32.MaxValue, ser.AnimeSeriesID.Value);
              }
              LoadFacade();
              });
              cmenu.AddAction(Translation.MarkAllAsUnwatched, () =>
              {
              foreach (AnimeSeriesVM ser in grp.AllSeries)
              {
                  if (ser.AnimeSeriesID.HasValue)
                      JMMServerHelper.SetWatchedStatusOnSeries(false, Int32.MaxValue, ser.AnimeSeriesID.Value);
              }
              LoadFacade();
              });
              if (grp.AllSeries.Count == 1)
              {
              cmenu.AddAction(Translation.SeriesInformation, () => ShowAnimeInfoWindow(grp.AllSeries[0]));
              }
              History h = GetCurrent();
              if (h.Listing is GroupFilterVM)
              {
              GroupFilterVM gf = (GroupFilterVM) h.Listing;
              cmenu.Add(Translation.QuickSort + " ...", () =>
              {
                  string sortType = "";
                  GroupFilterSortDirection sortDirection = GroupFilterSortDirection.Asc;
                  if (gf.GroupFilterID.HasValue)
                  {
                      if (GroupFilterQuickSorts.ContainsKey(gf.GroupFilterID.Value))
                          sortDirection = GroupFilterQuickSorts[gf.GroupFilterID.Value].SortDirection;
                      if (!Utils.DialogSelectGFQuickSort(ref sortType, ref sortDirection, gf.GroupFilterName))
                      {
                          if (!GroupFilterQuickSorts.ContainsKey(gf.GroupFilterID.Value))
                              GroupFilterQuickSorts[gf.GroupFilterID.Value] = new QuickSort();
                          GroupFilterQuickSorts[gf.GroupFilterID.Value].SortType = sortType;
                          GroupFilterQuickSorts[gf.GroupFilterID.Value].SortDirection = sortDirection;
                          LoadFacade();
                          return ContextMenuAction.Exit;
                      }
                  }
                  return ContextMenuAction.Continue;
              });
              if ((gf.GroupFilterID.HasValue) && (GroupFilterQuickSorts.ContainsKey(gf.GroupFilterID.Value)))
              {
                  cmenu.AddAction(Translation.RemoveQuickSort, () =>
                  {
                      GroupFilterQuickSorts.Remove(gf.GroupFilterID.Value);
                      LoadFacade();
                  });
              }
              }

              // ReSharper disable ImplicitlyCapturedClosure
              cmenu.AddAction(Translation.RandomSeries, () =>
              // ReSharper restore ImplicitlyCapturedClosure
              {
              RandomWindow_CurrentEpisode = null;
              RandomWindow_CurrentSeries = null;
              RandomWindow_LevelObject = grp;
              RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.Group;
              RandomWindow_RandomType = RandomObjectType.Series;
              GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
              });
              // ReSharper disable ImplicitlyCapturedClosure
              cmenu.AddAction(Translation.RandomEpisode, () =>
              // ReSharper restore ImplicitlyCapturedClosure
              {
              RandomWindow_CurrentEpisode = null;
              RandomWindow_CurrentSeries = null;
              RandomWindow_LevelObject = grp;
              RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.Group;
              RandomWindow_RandomType = RandomObjectType.Episode;
              GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);
              });

              cmenu.Add(Translation.AdvancedOptions + " ...", () => ShowContextMenuAdvancedOptionsGroup(grp.GroupName));

              return cmenu.Show();
        }