Ejemplo n.º 1
0
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            if (MA3WindowManager.HandleWindowChangeButton(control))
            {
                return;
            }

            if (btnRefresh != null && control == btnRefresh)
            {
                btnRefresh.IsFocused = false;
                m_Facade.Focus       = true;
                LoadData();
            }

            if (control == m_Facade)
            {
                // show the files if we are looking at a torrent
                GUIListItem item = m_Facade.SelectedListItem;
                if (item == null || item.TVTag == null)
                {
                    return;
                }
                if (item.TVTag.GetType() == typeof(VM_AnimeEpisode_User))
                {
                    VM_AnimeEpisode_User ep = item.TVTag as VM_AnimeEpisode_User;
                    if (ep != null)
                    {
                        MainWindow.vidHandler.ResumeOrPlay(ep);
                    }
                }
            }

            base.OnClicked(controlId, control, actionType);
        }
Ejemplo n.º 2
0
 protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
 {
     if (MA3WindowManager.HandleWindowChangeButton(control))
     {
         return;
     }
     base.OnClicked(controlId, control, actionType);
 }
Ejemplo n.º 3
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if (control == btnPosters)
            {
                GUIWindowManager.CloseCurrentWindow();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.POSTERS, false);
            }

            if (control == btnFanart)
            {
                GUIWindowManager.CloseCurrentWindow();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.FANART, false);
            }

            if (MA3WindowManager.HandleWindowChangeButton(control))
            {
                return;
            }
        }
Ejemplo n.º 4
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if (this.btnGetMissingInfo != null && control == this.btnGetMissingInfo)
            {
                MainWindow.ServerHelper.DownloadCharacterImagesForSeiyuu(seiyuu);
                setGUIProperty("Status", "Refreshing view...");
                this.btnGetMissingInfo.IsFocused = false;
                GUIControl.FocusControl(GetID, 50);

                return;
            }

            if (MA3WindowManager.HandleWindowChangeButton(control))
            {
                return;
            }

            base.OnClicked(controlId, control, actionType);
        }
Ejemplo n.º 5
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if (this.btnNavLeft != null && control == this.btnNavLeft)
            {
                GUIWindowManager.CloseCurrentWindow();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.CHARACTERS, false);

                return;
            }

            if (this.btnNavRight != null && control == this.btnNavRight)
            {
                GUIWindowManager.CloseCurrentWindow();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.RELATIONS, false);

                return;
            }

            if (this.btnInfoPage != null && control == this.btnInfoPage)
            {
                HideControls();
                dummyPageInfo.Visible = true;
            }

            if (this.btnStatsPage != null && control == this.btnStatsPage)
            {
                HideControls();
                dummyPageStatistics.Visible = true;
            }

            if (this.btnGroupsPage != null && control == this.btnGroupsPage)
            {
                HideControls();
                dummyPageGroups.Visible = true;
            }

            if (MA3WindowManager.HandleWindowChangeButton(control))
            {
                return;
            }

            base.OnClicked(controlId, control, actionType);
        }
Ejemplo n.º 6
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if (control == btnWideBanners)
            {
                GUIWindowManager.CloseCurrentWindow();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.WIDEBANNERS, false);
            }

            if (control == btnFanart)
            {
                GUIWindowManager.CloseCurrentWindow();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.FANART, false);
            }

            if (control == buttonLayouts)
            {
                switch (CurrentView)
                {
                case GUIFacadeControl.Layout.LargeIcons:
                    m_Facade.CurrentLayout = GUIFacadeControl.Layout.Filmstrip;
                    CurrentView            = GUIFacadeControl.Layout.Filmstrip;
                    BaseConfig.Settings.LastPosterViewMode = GUIFacadeControl.Layout.Filmstrip;
                    BaseConfig.Settings.Save();
                    break;

                case GUIFacadeControl.Layout.Filmstrip:
                    m_Facade.CurrentLayout = GUIFacadeControl.Layout.LargeIcons;
                    CurrentView            = GUIFacadeControl.Layout.LargeIcons;
                    BaseConfig.Settings.LastPosterViewMode = GUIFacadeControl.Layout.LargeIcons;
                    BaseConfig.Settings.Save();
                    break;
                }

                UpdateLayoutButton();
                GUIControl.FocusControl(GetID, controlId);
            }

            if (MA3WindowManager.HandleWindowChangeButton(control))
            {
                return;
            }
        }
Ejemplo n.º 7
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            //BaseConfig.MyAnimeLog.Write("OnClicked: {0}", controlId.ToString());



            if (control == this.m_Facade)
            {
                AniDB_Anime_RelationVM ra = m_Facade.SelectedListItem.TVTag as AniDB_Anime_RelationVM;
                if (ra != null && ra.AnimeSeries != null)
                {
                    // show relations for this anime
                    MainWindow.GlobalSeriesID = ra.AnimeSeries.AnimeSeriesID.Value;
                    GUIWindowManager.CloseCurrentWindow();
                    GUIWindowManager.ActivateWindow(Constants.WindowIDs.RELATIONS, false);
                }
                else
                {
                    Utils.DialogMsg("Error", "You do not have this series in your collection");
                    return;
                }
            }

            if (this.btnGetMissingInfo != null && control == this.btnGetMissingInfo)
            {
                MainWindow.ServerHelper.DownloadRelatedAnime(mainAnime.AnimeID);
                setGUIProperty("Related.DownloadStatus", "Waiting on server...");
                GUIControl.FocusControl(GetID, 50);

                return;
            }

            if (MA3WindowManager.HandleWindowChangeButton(control))
            {
                return;
            }

            base.OnClicked(controlId, control, actionType);
        }
Ejemplo n.º 8
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if (MA3WindowManager.HandleWindowChangeButton(control))
            {
                return;
            }

            if (this.btnServerStatus != null && control == this.btnServerStatus)
            {
                ShowPageServerStatus();
                this.btnServerStatus.IsFocused = false;
                m_Facade.Focus = true;
            }

            if (this.btnListUnlinkedFiles != null && control == this.btnListUnlinkedFiles)
            {
                ShowPageUnlinkedFiles();
                this.btnListUnlinkedFiles.IsFocused = false;
                m_Facade.Focus = true;
            }

            if (this.btnRunImport != null && control == this.btnRunImport)
            {
                this.btnRunImport.IsFocused = false;
                m_Facade.Focus = true;
                JMMServerVM.Instance.clientBinaryHTTP.RunImport();

                ShowPageServerStatus();

                Utils.DialogMsg("Done", "Process is running on the server");
                return;
            }

            if (this.btnRetryUnlinkedFiles != null && control == this.btnRetryUnlinkedFiles)
            {
                this.btnRetryUnlinkedFiles.IsFocused = false;
                m_Facade.Focus = true;

                JMMServerVM.Instance.clientBinaryHTTP.RescanUnlinkedFiles();

                ShowPageServerStatus();

                Utils.DialogMsg("Done", "Process is running on the server");

                return;
            }

            if (this.btnMoreOptions != null && control == this.btnMoreOptions)
            {
                ShowMoreOptionsMenu();
                this.btnMoreOptions.IsFocused = false;
                m_Facade.Focus = true;
            }



            if (actionType == MediaPortal.GUI.Library.Action.ActionType.ACTION_SELECT_ITEM)
            {
                OnShowContextMenu();
            }

            base.OnClicked(controlId, control, actionType);
        }
Ejemplo n.º 9
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if (MA3WindowManager.HandleWindowChangeButton(control))
            {
                return;
            }

            if (btnViewWatch != null && control == btnViewWatch)
            {
                this.btnViewWatch.IsFocused = false;
                m_Facade.Focus = true;

                if (dummyModeWatch != null)
                {
                    dummyModeWatch.Visible = true;
                }

                SetGUIProperty(GuiProperty.Recommendations_CurrentView, Translation.Watch);

                LoadData();
            }

            if (btnViewDownload != null && control == btnViewDownload)
            {
                this.btnViewDownload.IsFocused = false;
                m_Facade.Focus = true;

                if (dummyModeWatch != null)
                {
                    dummyModeWatch.Visible = false;
                }

                SetGUIProperty(GuiProperty.Recommendations_CurrentView, Translation.Download);

                LoadData();
            }

            if (this.btnGetMissingInfo != null && control == this.btnGetMissingInfo)
            {
                MainWindow.ServerHelper.DownloadRecommendedAnime();
                SetGUIProperty(GuiProperty.Recommendations_Status, Translation.WaitingOnServer + "...");
                GUIControl.FocusControl(GetID, 50);

                return;
            }

            if (control == this.m_Facade)
            {
                // show the files if we are looking at a torrent
                GUIListItem item = m_Facade.SelectedListItem;
                if (item == null || item.TVTag == null)
                {
                    return;
                }
                if (item.TVTag.GetType() == typeof(VM_Recommendation))
                {
                    VM_Recommendation rec = item.TVTag as VM_Recommendation;
                    if (rec != null)
                    {
                        if (dummyModeWatch != null && dummyModeWatch.Visible)
                        {
                            VM_AnimeEpisode_User aniEp = (VM_AnimeEpisode_User)VM_ShokoServer.Instance.ShokoServices.GetNextUnwatchedEpisode(rec.Recommended_AnimeSeries.AnimeSeriesID,
                                                                                                                                             VM_ShokoServer.Instance.CurrentUser.JMMUserID);
                            if (aniEp != null)
                            {
                                MainWindow.vidHandler.ResumeOrPlay(aniEp);
                            }
                            else
                            {
                                Utils.DialogMsg(Translation.Error, Translation.CouldNotFindFirstEpisode);
                            }
                        }
                    }
                }
            }

            base.OnClicked(controlId, control, actionType);
        }
Ejemplo n.º 10
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if (MA3WindowManager.HandleWindowChangeButton(control))
            {
                return;
            }

            if (control == this.btnCurrentMinusOne)
            {
                MainWindow.CurrentCalendarMonth  = monthMinusOne.Month;
                MainWindow.CurrentCalendarYear   = monthMinusOne.Year;
                MainWindow.CurrentCalendarButton = 3;
                GUIWindowManager.CloseCurrentWindow();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.CALENDAR, false);

                btnCurrentPlusOne.Focus  = false;
                btnCurrentMinusOne.Focus = false;

                return;
            }

            if (control == this.btnCurrentMinusTwo)
            {
                MainWindow.CurrentCalendarMonth  = monthMinusTwo.Month;
                MainWindow.CurrentCalendarYear   = monthMinusTwo.Year;
                MainWindow.CurrentCalendarButton = 2;
                GUIWindowManager.CloseCurrentWindow();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.CALENDAR, false);

                return;
            }

            if (control == this.btnCurrentMinusThree)
            {
                MainWindow.CurrentCalendarMonth  = monthMinusThree.Month;
                MainWindow.CurrentCalendarYear   = monthMinusThree.Year;
                MainWindow.CurrentCalendarButton = 1;
                GUIWindowManager.CloseCurrentWindow();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.CALENDAR, false);

                return;
            }

            if (control == this.btnCurrentPlusOne)
            {
                MainWindow.CurrentCalendarMonth  = monthPlusOne.Month;
                MainWindow.CurrentCalendarYear   = monthPlusOne.Year;
                MainWindow.CurrentCalendarButton = 4;
                GUIWindowManager.CloseCurrentWindow();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.CALENDAR, false);

                btnCurrentPlusOne.Focus  = false;
                btnCurrentMinusOne.Focus = false;

                return;
            }

            if (control == this.btnCurrentPlusTwo)
            {
                MainWindow.CurrentCalendarMonth  = monthPlusTwo.Month;
                MainWindow.CurrentCalendarYear   = monthPlusTwo.Year;
                MainWindow.CurrentCalendarButton = 5;
                GUIWindowManager.CloseCurrentWindow();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.CALENDAR, false);

                return;
            }

            if (control == this.btnCurrentPlusThree)
            {
                MainWindow.CurrentCalendarMonth  = monthPlusThree.Month;
                MainWindow.CurrentCalendarYear   = monthPlusThree.Year;
                MainWindow.CurrentCalendarButton = 6;
                GUIWindowManager.CloseCurrentWindow();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.CALENDAR, false);

                return;
            }

            base.OnClicked(controlId, control, actionType);
        }
Ejemplo n.º 11
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if (MA3WindowManager.HandleWindowChangeButton(control))
            {
                return;
            }

            if (control == this.btnTorrentsUIPage)
            {
                this.btnTorrentsUIPage.IsFocused = false;
                ShowPageTorrents();
                m_Facade.Focus = true;
            }

            if (control == this.btnSearchPage)
            {
                this.btnSearchPage.Focus = false;
                ShowPageSearch(true);
                m_Facade.Focus = true;
            }

            if (control == this.btnBrowseTorrentsPage)
            {
                this.btnBrowseTorrentsPage.Focus = false;
                ShowPageBrowseTorrents();
                m_Facade.Focus = true;
            }

            if (control == this.m_Facade)
            {
                // show the files if we are looking at a torrent
                GUIListItem item = m_Facade.SelectedListItem;

                //BaseConfig.MyAnimeLog.Write("Type: {0}", item.TVTag.GetType());

                // torrents
                // show the files if we are looking at a torrent
                if (item.TVTag.GetType() == typeof(Torrent))
                {
                    Torrent torItem = item.TVTag as Torrent;
                    if (torItem != null)
                    {
                        curTorrent = torItem;
                        List <TorrentFile> torfiles = new List <TorrentFile>();
                        if (MainWindow.uTorrent.GetFileList(torItem.Hash, ref torfiles))
                        {
                            ShowPageTorrentFiles(torfiles);
                        }
                    }
                }

                if (item.TVTag.GetType() == typeof(TorrentFile))
                {
                    if (item.Label == UpFolder)
                    {
                        ShowPageTorrents();
                    }
                }

                if (item.TVTag.GetType() == typeof(TorrentLink) && dummyPageSearch.Visible)
                {
                    TorrentLink torLink = item.TVTag as TorrentLink;
                    if (torLink == null)
                    {
                        return;
                    }

                    ShowContextMenuSearch(torLink);
                }

                if (item.TVTag.GetType() == typeof(TorrentLink) && dummyPageBrowse.Visible)
                {
                    TorrentLink torLink = item.TVTag as TorrentLink;
                    if (torLink == null)
                    {
                        return;
                    }

                    ShowContextMenuBrowse(torLink);
                }
            }

            base.OnClicked(controlId, control, actionType);
        }
Ejemplo n.º 12
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if (this.btnGetMissingInfo != null && control == this.btnGetMissingInfo)
            {
                JMMServerVM.Instance.clientBinaryHTTP.UpdateAnimeData(mainAnime.AnimeID);
                setGUIProperty("Character.Status", "Request sent to server, please refresh view...");

                this.btnGetMissingInfo.IsFocused = false;
                GUIControl.FocusControl(GetID, 50);

                return;
            }

            if (this.btnRefreshView != null && control == this.btnRefreshView)
            {
                MainWindow.ServerHelper.DownloadCharacterCreatorImages(mainAnime);
                setGUIProperty("Character.Status", "Refreshing view...");
                this.btnRefreshView.IsFocused = false;
                GUIControl.FocusControl(GetID, 50);

                return;
            }

            if (this.btnSeiyuu != null && control == this.btnSeiyuu)
            {
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.ACTORS, false);
                return;
            }

            if (MA3WindowManager.HandleWindowChangeButton(control))
            {
                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)
                {
                    GUIListItem item = this.m_Facade.SelectedListItem;

                    if (item == null || item.TVTag == null || !(item.TVTag is AniDB_CharacterVM))
                    {
                        return;
                    }

                    AniDB_CharacterVM aniChar = item.TVTag as AniDB_CharacterVM;
                    if (aniChar == null)
                    {
                        return;
                    }

                    AniDB_SeiyuuVM actor = aniChar.Creator;
                    MainWindow.GlobalSeiyuuID = actor.AniDB_SeiyuuID;
                    GUIWindowManager.ActivateWindow(Constants.WindowIDs.ACTORS, false);
                }
            }
            catch { }



            base.OnClicked(controlId, control, actionType);
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if (MA3WindowManager.HandleWindowChangeButton(control))
            {
                return;
            }

            if (btnViewWatch != null && control == btnViewWatch)
            {
                this.btnViewWatch.IsFocused = false;
                m_Facade.Focus = true;

                if (dummyModeWatch != null)
                {
                    dummyModeWatch.Visible = true;
                }
                if (dummyModeDownload != null)
                {
                    dummyModeDownload.Visible = false;
                }

                setGUIProperty("Recommendations.CurrentView", "Watch");

                LoadData();
            }

            if (btnViewDownload != null && control == btnViewDownload)
            {
                this.btnViewDownload.IsFocused = false;
                m_Facade.Focus = true;

                if (dummyModeWatch != null)
                {
                    dummyModeWatch.Visible = false;
                }
                if (dummyModeDownload != null)
                {
                    dummyModeDownload.Visible = true;
                }

                setGUIProperty("Recommendations.CurrentView", "Download");

                LoadData();
            }

            if (this.btnGetMissingInfo != null && control == this.btnGetMissingInfo)
            {
                MainWindow.ServerHelper.DownloadRecommendedAnime();
                setGUIProperty("Recommendations.DownloadStatus", "Waiting on server...");
                GUIControl.FocusControl(GetID, 50);

                return;
            }

            if (control == this.m_Facade)
            {
                // show the files if we are looking at a torrent
                GUIListItem item = m_Facade.SelectedListItem;
                if (item == null || item.TVTag == null)
                {
                    return;
                }
                if (item.TVTag.GetType() == typeof(RecommendationVM))
                {
                    RecommendationVM rec = item.TVTag as RecommendationVM;
                    if (rec != null)
                    {
                        if (dummyModeWatch != null && dummyModeWatch.Visible)
                        {
                            JMMServerBinary.Contract_AnimeEpisode ep = JMMServerVM.Instance.clientBinaryHTTP.GetNextUnwatchedEpisode(rec.Recommended_AnimeSeries.AnimeSeriesID.Value,
                                                                                                                                     JMMServerVM.Instance.CurrentUser.JMMUserID);
                            if (ep != null)
                            {
                                AnimeEpisodeVM aniEp = new AnimeEpisodeVM(ep);
                                MainWindow.vidHandler.ResumeOrPlay(aniEp);
                            }
                            else
                            {
                                Utils.DialogMsg("Error", "Could not find the first episode");
                            }
                        }

                        if (dummyModeDownload != null && dummyModeDownload.Visible)
                        {
                            AniDB_AnimeVM recanime = rec.Recommended_AniDB_Anime;
                            if (recanime != null)
                            {
                                DownloadHelper.SearchAnime(recanime);
                            }
                        }
                    }
                }
            }

            base.OnClicked(controlId, control, actionType);
        }
Ejemplo n.º 15
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if (control == btnWideBanners)
            {
                GUIWindowManager.CloseCurrentWindow();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.WIDEBANNERS, false);
            }

            if (control == btnPosters)
            {
                GUIWindowManager.CloseCurrentWindow();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.POSTERS, false);
            }

            if (control == buttonLayouts)
            {
                bool shouldContinue = false;
                do
                {
                    shouldContinue = false;
                    switch (CurrentView)
                    {
                    case GUIFacadeControl.Layout.List:
                        CurrentView = GUIFacadeControl.Layout.Playlist;
                        if (!AllowView(CurrentView) || m_Facade.PlayListLayout == null)
                        {
                            shouldContinue = true;
                        }
                        else
                        {
                            m_Facade.CurrentLayout = GUIFacadeControl.Layout.Playlist;
                            BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.Playlist;
                            BaseConfig.Settings.Save();
                        }
                        break;

                    case GUIFacadeControl.Layout.Playlist:
                        CurrentView = GUIFacadeControl.Layout.SmallIcons;
                        if (!AllowView(CurrentView) || m_Facade.ThumbnailLayout == null)
                        {
                            shouldContinue = true;
                        }
                        else
                        {
                            m_Facade.CurrentLayout = GUIFacadeControl.Layout.SmallIcons;
                            BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.SmallIcons;
                            BaseConfig.Settings.Save();
                        }
                        break;

                    case GUIFacadeControl.Layout.SmallIcons:
                        CurrentView = GUIFacadeControl.Layout.LargeIcons;
                        if (!AllowView(CurrentView) || m_Facade.ThumbnailLayout == null)
                        {
                            shouldContinue = true;
                        }
                        else
                        {
                            m_Facade.CurrentLayout = GUIFacadeControl.Layout.LargeIcons;
                            BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.LargeIcons;
                            BaseConfig.Settings.Save();
                        }
                        break;

                    case GUIFacadeControl.Layout.LargeIcons:
                        CurrentView = GUIFacadeControl.Layout.Filmstrip;
                        if (!AllowView(CurrentView) || m_Facade.FilmstripLayout == null)
                        {
                            shouldContinue = true;
                        }
                        else
                        {
                            m_Facade.CurrentLayout = GUIFacadeControl.Layout.Filmstrip;
                            BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.Filmstrip;
                            BaseConfig.Settings.Save();
                        }
                        break;

                    case GUIFacadeControl.Layout.Filmstrip:
                        CurrentView = GUIFacadeControl.Layout.List;
                        if (!AllowView(CurrentView) || m_Facade.ListLayout == null)
                        {
                            shouldContinue = true;
                        }
                        else
                        {
                            m_Facade.CurrentLayout = GUIFacadeControl.Layout.List;
                            BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.List;
                            BaseConfig.Settings.Save();
                        }
                        break;
                    }
                } while (shouldContinue);
                UpdateLayoutButton();
                GUIControl.FocusControl(GetID, controlId);
            }

            if (MA3WindowManager.HandleWindowChangeButton(control))
            {
                return;
            }

            if (actionType != MediaPortal.GUI.Library.Action.ActionType.ACTION_SELECT_ITEM)
            {
                return;                                                                                         // some other events raised onClicked too for some reason?
            }
        }