Ejemplo n.º 1
0
        protected override void OnPageLoad()
        {
            MPTVSeriesLog.Write("OnPageLoad() started.", MPTVSeriesLog.LogLevel.Debug);
            if (m_Facade == null)
            {
                // Most likely the skin does not exist
                GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                dlg.Reset();
                dlg.SetHeading(Translation.wrongSkin);
                dlg.DoModal(GetID);
                GUIWindowManager.ShowPreviousWindow();
                return;
            }

            GUIPropertyManager.SetProperty("#currentmodule", pluginName);

            ImageAllocator.SetFontName(m_Facade.AlbumListLayout == null ? m_Facade.ListLayout.FontName : m_Facade.AlbumListLayout.FontName);

            #region Clear GUI Properties
            // Clear GUI Properties when first entering the plugin
            // This will avoid ugly property names being seen before
            // its corresponding value is assigned
            if (!m_bPluginLoaded)
            {
                clearGUIProperty(guiProperty.Subtitle);
                clearGUIProperty(guiProperty.Title);
                clearGUIProperty(guiProperty.Description);

                clearGUIProperty(guiProperty.CurrentView);
                clearGUIProperty(guiProperty.SimpleCurrentView);
                clearGUIProperty(guiProperty.NextView);
                clearGUIProperty(guiProperty.LastView);
                clearGUIProperty(guiProperty.SeriesCount);
                clearGUIProperty(guiProperty.GroupCount);
                clearGUIProperty(guiProperty.FilteredEpisodeCount);
                clearGUIProperty(guiProperty.WatchedCount);
                clearGUIProperty(guiProperty.UnWatchedCount);

                clearFieldsForskin("Series");
                clearFieldsForskin("Season");
                clearFieldsForskin("Episode");
            }
            #endregion

            localLogos.appendEpImage = m_Episode_Image == null ? true : false;

            #region View Setup and Loading Parameters
            bool viewSwitched = false;
            m_LoadingParameter = GetLoadingParameter();

            if (m_LoadingParameter.Type != LoadingParameterType.None && m_LoadingParameter.Type != LoadingParameterType.View)
            {
                m_JumpToViewLevel = true;

                if (m_allViews == null || m_allViews.Count == 0) m_allViews = logicalView.getAll(false);
                if (m_CurrLView == null) switchView((string)DBOption.GetOptions("lastView"));

                int viewLevels = m_CurrLView.m_steps.Count;

                m_SelectedSeries = Helper.getCorrespondingSeries(Convert.ToInt32(m_LoadingParameter.SeriesId));
                if (m_SelectedSeries == null)
                {
                    MPTVSeriesLog.Write("Failed to get series object from loading parameter!", MPTVSeriesLog.LogLevel.Debug);
                    m_LoadingParameter.Type = LoadingParameterType.None;
                }
                else
                {
                    MPTVSeriesLog.Write(string.Format("Loading into series: {0}", m_SelectedSeries.ToString(), MPTVSeriesLog.LogLevel.Debug));
                    m_stepSelection = new string[] { m_LoadingParameter.SeriesId };
                    m_stepSelections.Add(m_stepSelection);
                    pushFieldsToSkin(m_SelectedSeries, "Series");
                }

                switch (m_LoadingParameter.Type)
                {
                    #region Series
                    case LoadingParameterType.Series:
                        // load into Season view if multiple seasons exists
                        // will auto drill down to current available season if only one exists
                        if (viewLevels > 1) m_CurrViewStep = viewLevels - 2;
                        else m_CurrViewStep = 0;
                        this.listLevel = Listlevel.Season;
                        break;
                    #endregion

                    #region Season
                    case LoadingParameterType.Season:
                        m_SelectedSeason = Helper.getCorrespondingSeason(Convert.ToInt32(m_LoadingParameter.SeriesId), Convert.ToInt32(m_LoadingParameter.SeasonIdx));
                        if (m_SelectedSeason == null)
                        {
                            m_LoadingParameter.Type = LoadingParameterType.None;
                            break;
                        }
                        // load into episode view for series/season
                        if (viewLevels > 1) m_CurrViewStep = viewLevels - 1;
                        else m_CurrViewStep = 0;
                        this.listLevel = Listlevel.Episode;
                        m_stepSelection = new string[] { m_LoadingParameter.SeriesId, m_LoadingParameter.SeasonIdx };
                        m_stepSelections.Add(m_stepSelection);
                        break;
                    #endregion

                    #region Episode
                    case LoadingParameterType.Episode:
                        m_SelectedEpisode = DBEpisode.Get(Convert.ToInt32(m_LoadingParameter.SeriesId), Convert.ToInt32(m_LoadingParameter.SeasonIdx), Convert.ToInt32(m_LoadingParameter.EpisodeIdx));
                        if (m_SelectedEpisode == null)
                        {
                            m_LoadingParameter.Type = LoadingParameterType.None;
                            break;
                        }
                        // load into episode view for series/season
                        if (viewLevels > 1) m_CurrViewStep = viewLevels - 1;
                        else m_CurrViewStep = 0;
                        this.listLevel = Listlevel.Episode;
                        m_stepSelection = new string[] { m_LoadingParameter.SeriesId, m_LoadingParameter.SeasonIdx };
                        m_stepSelections.Add(m_stepSelection);
                        break;
                    #endregion
                }

                setViewLabels();
            }

            // Initialize View, also check if current view is locked after exiting and re-entering plugin
            if (m_LoadingParameter.Type == LoadingParameterType.None || m_LoadingParameter.Type == LoadingParameterType.View)
            {
                m_JumpToViewLevel = false;

                if (m_CurrLView == null || (m_CurrLView.ParentalControl && logicalView.IsLocked) || !string.IsNullOrEmpty(m_LoadingParameter.ViewName))
                {
                    // Get available Views
                    m_allViews = logicalView.getAll(false);
                    if (m_allViews.Count > 0)
                    {
                        try
                        {
                            if (m_LoadingParameter.Type == LoadingParameterType.View)
                            {
                                viewSwitched = switchView(m_LoadingParameter.ViewName);
                            }
                            else
                            {
                                viewSwitched = switchView((string)DBOption.GetOptions("lastView"));
                            }
                        }
                        catch
                        {
                            viewSwitched = false;
                            MPTVSeriesLog.Write("Error when switching view");
                        }
                    }
                    else
                    {
                        viewSwitched = false;
                        MPTVSeriesLog.Write("Error, cannot display items because no Views have been found!");
                    }
                }
                else
                {
                    viewSwitched = true;
                    setViewLabels();
                }

                // If unable to load view, exit
                if (!viewSwitched)
                {
                    GUIWindowManager.ShowPreviousWindow();
                    return;
                }
            }
            #endregion

            backdrop.GUIImageOne = FanartBackground;
            backdrop.GUIImageTwo = FanartBackground2;
            backdrop.LoadingImage = loadingImage;

            DBEpisode previouslySelectedEpisode = m_SelectedEpisode;

            LoadFacade();
            m_Facade.Focus = true;

            // Update Button Labels with translations
            if (viewMenuButton != null)
                viewMenuButton.Label = Translation.ButtonSwitchView;

            if (filterButton != null)
                filterButton.Label = Translation.Filters;

            if (ImportButton != null)
                ImportButton.Label = Translation.ButtonRunImport;

            if (LayoutMenuButton != null)
                LayoutMenuButton.Label = Translation.ButtonChangeLayout;

            if (OptionsMenuButton != null)
                OptionsMenuButton.Label = Translation.ButtonOptions;

            setProcessAnimationStatus(m_parserUpdaterWorking);

            if (m_Logos_Image != null)
            {
                logosHeight = m_Logos_Image.Height;
                logosWidth = m_Logos_Image.Width;
            }

            m_bPluginLoaded = true;

            Helper.disableNativeAutoplay();

            // Ask to Rate Episode, onPageLoad is triggered after returning from player
            if (ask2Rate != null)
            {
                showRatingsDialog(ask2Rate, true);
                ask2Rate = null;
                // Refresh the facade if we want to see the submitted rating
                if (this.listLevel == Listlevel.Episode)
                {
                    LoadFacade();
                }
            }

            // Play after subtitle download
            if (m_PlaySelectedEpisodeAfterSubtitles && previouslySelectedEpisode != null && previouslySelectedEpisode == m_SelectedEpisode)
            {
                CommonPlayEpisodeAction();
                m_PlaySelectedEpisodeAfterSubtitles = false;
            }

            // Push last update time to skin
            setGUIProperty(guiProperty.LastOnlineUpdate, DBOption.GetOptions(DBOption.cImport_OnlineUpdateScanLastTime));

            MPTVSeriesLog.Write("OnPageLoad() completed.", MPTVSeriesLog.LogLevel.Debug);
        }
Ejemplo n.º 2
0
        void setNewListLevelOfCurrView(int step)
        {
            if (dummyIsSeriesPosters != null)
            {
                dummyIsSeriesPosters.Visible = (DBOption.GetOptions(DBOption.cView_Series_ListFormat) == "Filmstrip"
                                             || DBOption.GetOptions(DBOption.cView_Series_ListFormat) == "ListPosters"
                                             || DBOption.GetOptions(DBOption.cView_Series_ListFormat) == "Coverflow");
                dummyIsSeriesPosters.UpdateVisibility();
            }

            resetListLevelDummies();

            switch (m_CurrLView.gettypeOfStep(step))
            {
                case logicalViewStep.type.group:
                    listLevel = Listlevel.Group;
                    if (dummyIsGroups != null) dummyIsGroups.Visible = true;
                    if (dummyIsGroups != null) dummyIsGroups.UpdateVisibility();
                    break;
                case logicalViewStep.type.series:
                    listLevel = Listlevel.Series;
                    if (dummyIsSeries != null) dummyIsSeries.Visible = true;
                    if (dummyIsSeries != null) dummyIsSeries.UpdateVisibility();
                    break;
                case logicalViewStep.type.season:
                    listLevel = Listlevel.Season;
                    if (dummyIsSeasons != null) dummyIsSeasons.Visible = true;
                    if (dummyIsSeasons != null) dummyIsSeasons.UpdateVisibility();
                    break;
                case logicalViewStep.type.episode:
                    listLevel = Listlevel.Episode;
                    if (dummyIsEpisodes != null) dummyIsEpisodes.Visible = true;
                    if (dummyIsEpisodes != null) dummyIsEpisodes.UpdateVisibility();
                    break;
            }
        }
Ejemplo n.º 3
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.º 4
0
        private void ShowParentLevelForGroup(AnimeGroupVM grp)
        {
            while (grp != null)
            {
                List<AnimeGroupVM> subGroups = grp.SubGroups;
                List<AnimeSeriesVM> seriesList = grp.ChildSeries;

                if ((seriesList.Count + subGroups.Count) > 1)
                {
                    curAnimeGroupViewed = grp;
                    curAnimeGroup = grp;

                    listLevel = Listlevel.Series;
                    return;
                }
                else
                {
                    // go up one level
                    if (grp.AnimeGroupParentID.HasValue)
                        grp = grp.ParentGroup;
                    else
                    {
                        // only one series or subgroup so go all the way back to the group list
                        listLevel = Listlevel.Group;
                        curAnimeEpisodeType = null;
                        curAnimeSeries = null;
                        return;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public override void OnAction(MediaPortal.GUI.Library.Action action)
        {
            //BaseConfig.MyAnimeLog.Write("Received action: {0}/{1}", action.wID, (char)(action.m_key.KeyChar));

            switch (action.wID)
            {
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_DOWN:
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_UP:

                    //Reset autoclose timer on search
                    if (searchTimer.Enabled)
                    {
                        searchTimer.Stop();
                        searchTimer.Start();
                    }

                    base.OnAction(action);
                    break;
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_LEFT:
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_RIGHT:

                    base.OnAction(action);
                    break;
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_KEY_PRESSED:

                    //when the list is selected, search the input
                    if (GUIWindowManager.ActiveWindowEx == this.GetID)
                    {
                        if ((m_Facade.CurrentLayout == GUIFacadeControl.Layout.List && m_Facade.ListLayout.IsFocused)
                            || (m_Facade.CurrentLayout == GUIFacadeControl.Layout.LargeIcons && m_Facade.ThumbnailLayout.IsFocused)
                            || (m_Facade.CurrentLayout == GUIFacadeControl.Layout.Filmstrip && m_Facade.FilmstripLayout.IsFocused)
                            || (m_Facade.CurrentLayout == GUIFacadeControl.Layout.CoverFlow && m_Facade.CoverFlowLayout.IsFocused))
                            OnSearchChar((char)(action.m_key.KeyChar));
                    }
                    break;

                case MediaPortal.GUI.Library.Action.ActionType.ACTION_PARENT_DIR:
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_HOME:
                    UpdateSearchPanel(false);
                    ImageAllocator.FlushAll();
                    GUIWindowManager.ShowPreviousWindow();
                    break;

                case MediaPortal.GUI.Library.Action.ActionType.ACTION_PLAY:
                    BaseConfig.MyAnimeLog.Write("Received PLAY action");

                    try
                    {
                        if (listLevel == Listlevel.Group)
                        {
                            if (curAnimeGroup == null) return;
                            JMMServerBinary.Contract_AnimeEpisode contract = JMMServerVM.Instance.clientBinaryHTTP.GetNextUnwatchedEpisodeForGroup(curAnimeGroup.AnimeGroupID,
                                JMMServerVM.Instance.CurrentUser.JMMUserID);
                            if (contract == null) return;
                            AnimeEpisodeVM ep = new AnimeEpisodeVM(contract);
                            vidHandler.ResumeOrPlay(ep);
                        }

                        if (listLevel == Listlevel.Series)
                        {
                            //curAnimeSeries = null;
                            if (curAnimeSeries == null) return;
                            JMMServerBinary.Contract_AnimeEpisode contract = JMMServerVM.Instance.clientBinaryHTTP.GetNextUnwatchedEpisode(curAnimeSeries.AnimeSeriesID.Value,
                                JMMServerVM.Instance.CurrentUser.JMMUserID);
                            if (contract == null) return;
                            AnimeEpisodeVM ep = new AnimeEpisodeVM(contract);
                            vidHandler.ResumeOrPlay(ep);
                        }
                    }
                    catch (Exception ex)
                    {
                        BaseConfig.MyAnimeLog.Write(ex.ToString());
                    }
                    break;

                case MediaPortal.GUI.Library.Action.ActionType.ACTION_PREVIOUS_MENU:
                    if (searchTimer.Enabled)
                    {
                        OnSearchAction(SearchAction.EndSearch);
                        return;
                    }

                    // back one level
                    if (listLevel == Listlevel.GroupFilter)
                    {
                        goto case MediaPortal.GUI.Library.Action.ActionType.ACTION_HOME;
                    }
                    else
                    {
                        string msg = string.Format("LIST LEVEL:: {0} - GF: {1} - GFSub2: {2}", listLevel, curGroupFilter, curGroupFilterSub2);

                        BaseConfig.MyAnimeLog.Write(msg);
                        if (listLevel == Listlevel.GroupFilterSub)
                        {
                            listLevel = Listlevel.GroupFilter;
                            curGroupFilterSub = null;

                            LoadFacade();
                        }
                        if (listLevel == Listlevel.GroupFilterSub2)
                        {
                            // go back to GROUP FILTERS
                            listLevel = Listlevel.GroupFilterSub;
                            curGroupFilterSub2 = null;

                            LoadFacade();
                        }
                        if (listLevel == Listlevel.Group)
                        {
                            if (curGroupFilterSub2 == null)
                            {
                                // go back to GROUP FILTERS
                                listLevel = Listlevel.GroupFilter;
                            }
                            else
                            {
                                listLevel = Listlevel.GroupFilterSub2;
                            }
                            LoadFacade();
                            curAnimeGroup = null;
                        }

                        if (listLevel == Listlevel.Series)
                        {
                            // go back to GROUP
                            AnimeGroupVM parentGroup = curAnimeGroupViewed.ParentGroup;
                            if (parentGroup == null)
                                listLevel = Listlevel.Group;

                            ShowParentLevelForGroup(parentGroup);

                            LoadFacade();
                            curAnimeEpisodeType = null;
                            curAnimeSeries = null;
                        }

                        if (listLevel == Listlevel.EpisodeTypes)
                        {
                            // go back to SERIES
                            AnimeSeriesVM parentSeries = curAnimeEpisodeType.AnimeSeries;
                            ShowParentLevelForSeries(parentSeries);
                            LoadFacade();
                            return;
                        }

                        if (listLevel == Listlevel.Episode)
                        {
                            AnimeSeriesVM parentSeries = curAnimeEpisodeType.AnimeSeries;
                            if (parentSeries.EpisodeTypesToDisplay.Count == 1)
                                ShowParentLevelForSeries(parentSeries);
                            else
                            {
                                listLevel = Listlevel.EpisodeTypes;
                                curAnimeEpisodeType = null;
                            }

                            LoadFacade();
                            return;
                        }
                    }
                    break;

                default:
                    base.OnAction(action);
                    break;
            }
        }
Ejemplo n.º 6
0
        private void ShowChildrenLevelForSeries()
        {
            List<AnimeEpisodeTypeVM> episodeTypes = curAnimeSeries.EpisodeTypesToDisplay;
            if (episodeTypes.Count > 1)
            {
                listLevel = Listlevel.EpisodeTypes;
            }
            else if (episodeTypes.Count == 1)
            {
                setGUIProperty(guiProperty.SeriesTitle, curAnimeSeries.SeriesName);
                // only one so lets go straight to the episodes
                curAnimeEpisodeType = episodeTypes[0];
                listLevel = Listlevel.Episode;
                SetFanartForEpisodes();

                BaseConfig.MyAnimeLog.Write("Current list level: {0} - {1}", listLevel, curAnimeEpisodeType);
            }
        }
Ejemplo n.º 7
0
        private void ShowChildrenLevelForGroup()
        {
            List<AnimeGroupVM> subGroups = curAnimeGroupViewed.SubGroups;
            List<AnimeSeriesVM> seriesList = curAnimeGroupViewed.ChildSeries;

            int subLevelCount = seriesList.Count + subGroups.Count;

            if (subLevelCount > 1)
            {
                listLevel = Listlevel.Series;
                LoadFacade();
                return;
            }
            else if (subLevelCount == 1)
            {
                // keep drilling down until we find a series
                // or more than one sub level
                while (subLevelCount == 1 && subGroups.Count > 0)
                {
                    curAnimeGroupViewed = subGroups[0];
                    curAnimeGroup = subGroups[0];

                    subGroups = curAnimeGroup.SubGroups;
                    seriesList = curAnimeGroup.ChildSeries;
                    subLevelCount = seriesList.Count + subGroups.Count;
                }

                if (subGroups.Count == 0)
                {
                    // means we got all the way down to a series
                    if (seriesList.Count > 1)
                    {
                        listLevel = Listlevel.Series;
                    }
                    else if (seriesList.Count == 1)
                    {
                        curAnimeSeries = seriesList[0];
                        ShowChildrenLevelForSeries();
                    }
                }
                else
                {
                    // else we have more than one sub level to display
                    listLevel = Listlevel.Series;
                }
            }
        }