예제 #1
0
        protected override void OnShowContextMenu()
        {
            try
            {
                GUIListItem currentitem = m_Facade.SelectedListItem;
                if (currentitem == null || !(currentitem.TVTag is FanartContainer))
                {
                    return;
                }
                FanartContainer selectedFanart = currentitem.TVTag as FanartContainer;


                ContextMenu cmenu = new ContextMenu(Translation.Fanart);
                cmenu.AddAction(selectedFanart.IsImageEnabled ? Translation.Disable : Translation.Enable, () =>
                {
                    bool endis = !selectedFanart.IsImageEnabled;
                    ShokoServerHelper.EnableDisableFanart(endis, selectedFanart, AnimeID);
                    ShowFanart();
                });
                if (selectedFanart.IsImageEnabled)
                {
                    cmenu.AddAction(selectedFanart.IsImageDefault ? Translation.RemoveAsDefault : Translation.SetAsDefault, () =>
                    {
                        bool isdef = !selectedFanart.IsImageDefault;
                        ShokoServerHelper.SetDefaultFanart(isdef, selectedFanart, AnimeID);
                        ShowFanart();
                    });
                }
                cmenu.Show();
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("Exception in Fanart Chooser Context Menu: " + ex.Message + ex.StackTrace);
            }
        }
예제 #2
0
        protected override void OnShowContextMenu()
        {
            try
            {
                GUIListItem currentitem = m_Facade.SelectedListItem;
                if (currentitem == null || !(currentitem.TVTag is VM_TvDB_ImageWideBanner))
                {
                    return;
                }
                VM_TvDB_ImageWideBanner selectedBanner = currentitem.TVTag as VM_TvDB_ImageWideBanner;
                bool isDisabled = selectedBanner.Enabled == 0;

                ContextMenu cmenu = new ContextMenu(Translation.WideBanner);
                cmenu.AddAction(isDisabled ? Translation.Enable : Translation.Disable, () =>
                {
                    ShokoServerHelper.EnableDisableWideBanner(isDisabled, selectedBanner, AnimeID);
                    ShowWideBanners();
                });
                if (!isDisabled)
                {
                    cmenu.AddAction(selectedBanner.IsImageDefault ? Translation.RemoveAsDefault : Translation.SetAsDefault, () =>
                    {
                        ShokoServerHelper.SetDefaultWideBanner(!selectedBanner.IsImageDefault, selectedBanner, AnimeID);
                        ShowWideBanners();
                    });
                }
                cmenu.Show();
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("Exception in Wide Banner Chooser Context Menu: " + ex.Message);
                return;
            }
        }
예제 #3
0
        private void LoadGroups()
        {
            string mygroupsData    = "";
            string othergroupsData = "";

            List <CL_AniDB_GroupStatus> allGrps = ShokoServerHelper.GetReleaseGroupsForAnime(MainAnime.AnimeID);

            List <CL_AniDB_GroupStatus> mygrps    = new List <CL_AniDB_GroupStatus>();
            List <CL_AniDB_GroupStatus> othergrps = new List <CL_AniDB_GroupStatus>();

            foreach (CL_AniDB_GroupStatus grp in allGrps)
            {
                if (grp.UserCollecting)
                {
                    mygrps.Add(grp);
                }
                else
                {
                    othergrps.Add(grp);
                }
            }

            if (mygrps.Count > 0)
            {
                mygrps = mygrps.OrderByDescending(a => a.FileCount).ToList();

                foreach (CL_AniDB_GroupStatus grp in mygrps)
                {
                    mygroupsData += string.Format("{0} - ({1} {2})", grp.GroupName, grp.FileCount, Translation.LocalFiles);
                    mygroupsData += Environment.NewLine;
                }
            }
            else
            {
                mygroupsData = "-";
            }

            SetGUIProperty(GuiProperty.AnimeInfo_Groups_MyGroupsDescription, mygroupsData);


            if (othergrps.Count > 0)
            {
                // now sort the groups by name
                othergrps = othergrps.OrderBy(a => a.GroupName).ToList();

                foreach (CL_AniDB_GroupStatus grp in othergrps)
                {
                    othergroupsData += string.Format("{0} - {2}: {1}", grp.GroupName, grp.EpisodeRange, Translation.EpisodeRange);
                    othergroupsData += Environment.NewLine;
                }
            }
            else
            {
                othergroupsData = "-";
            }

            SetGUIProperty(GuiProperty.AnimeInfo_Groups_OtherGroupsDescription, othergroupsData);
        }
예제 #4
0
 private void LoadInfo()
 {
     if (MainWindow.GlobalSeriesID > 0)
     {
         serMain = ShokoServerHelper.GetSeries(MainWindow.GlobalSeriesID);
         if (serMain != null)
         {
             mainAnime = serMain.Anime;
         }
     }
 }
예제 #5
0
        private void ShowFanart()
        {
            GUIControl.ClearControl(GetID, m_Facade.GetID);


            VM_AnimeSeries_User ser = ShokoServerHelper.GetSeries(MainWindow.GlobalSeriesID);

            if (ser != null)
            {
                if (ser.CrossRefAniDBTvDBV2 != null && ser.CrossRefAniDBTvDBV2.Count > 0)
                {
                    AnimeID = ser.CrossRefAniDBTvDBV2[0].AnimeID;
                }
            }

            if (ser == null)
            {
                return;
            }

            BaseConfig.MyAnimeLog.Write("ShowFanart for {0}", AnimeID);

            foreach (FanartContainer fanart in ser.Anime.AniDB_AnimeCrossRefs.AllFanarts)
            {
                if (!File.Exists(fanart.FullImagePath))
                {
                    continue;
                }

                GUIListItem item = new GUIListItem();
                item.IconImage       = item.IconImageBig = fanart.FullThumbnailPath;
                item.TVTag           = fanart;
                item.OnItemSelected += onFacadeItemSelected;
                m_Facade.Add(item);
            }

            if (m_Facade.Count > 0)
            {
                m_Facade.SelectedListItemIndex = 0;

                // Work around for Filmstrip not allowing to programmatically select item
                if (m_Facade.CurrentLayout == GUIFacadeControl.Layout.Filmstrip)
                {
                }

                FanartContainer selectedFanart = m_Facade.SelectedListItem.TVTag as FanartContainer;
                if (selectedFanart != null)
                {
                    setFanartPreviewBackground(selectedFanart);
                }

                GUIControl.FocusControl(GetID, 50);
            }
        }
예제 #6
0
        void workerRefreshUnlinkedFiles_DoWork(object sender, DoWorkEventArgs e)
        {
            List <VM_VideoLocal> unlinkedVideos = ShokoServerHelper.GetUnlinkedVideos();

            List <GUIListItem> listItems = new List <GUIListItem>();

            foreach (VM_VideoLocal locFile in unlinkedVideos)
            {
                GUIListItem itm = new GUIListItem(locFile.FileName);
                itm.TVTag = locFile;
                listItems.Add(itm);
            }

            e.Result = listItems;
        }
예제 #7
0
        private void ShowWideBanners()
        {
            GUIControl.ClearControl(this.GetID, m_Facade.GetID);

            VM_AnimeSeries_User ser = ShokoServerHelper.GetSeries(MainWindow.GlobalSeriesID);

            if (ser != null)
            {
                if (ser.CrossRefAniDBTvDBV2 != null && ser.CrossRefAniDBTvDBV2.Count > 0)
                {
                    AnimeID = ser.CrossRefAniDBTvDBV2[0].AnimeID;
                }
            }

            if (ser != null)
            {
                List <VM_TvDB_ImageWideBanner> tvDBWideBanners = ser.Anime.AniDB_AnimeCrossRefs.TvDBImageWideBanners;

                GUIListItem item = null;
                foreach (VM_TvDB_ImageWideBanner banner in tvDBWideBanners)
                {
                    item                 = new GUIListItem();
                    item.IconImage       = item.IconImageBig = banner.FullImagePath;
                    item.TVTag           = banner;
                    item.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected);
                    m_Facade.Add(item);
                }


                if (m_Facade.Count > 0)
                {
                    m_Facade.SelectedListItemIndex = 0;
                    VM_TvDB_ImageWideBanner selectedBanner = m_Facade.SelectedListItem.TVTag as VM_TvDB_ImageWideBanner;
                    if (selectedBanner != null)
                    {
                        SetWideBannerProperties(selectedBanner);
                    }

                    GUIControl.FocusControl(GetID, 50);
                }
            }
        }
예제 #8
0
        public void RefreshEpisodes()
        {
            allEpisodes = new List <VM_AnimeEpisode_User>();

            try
            {
                TvDBSummary summ = Anime.TvSummary;

                // Normal episodes
                foreach (VM_AnimeEpisode_User ep in ShokoServerHelper.GetEpisodesForSeries(AnimeSeriesID))
                {
                    ep.SetTvDBInfo(summ);
                    allEpisodes.Add(ep);
                }
                allEpisodes = allEpisodes.OrderBy(a => a.EpisodeType).ThenBy(a => a.EpisodeNumber).ToList();
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write(ex.ToString());
            }
        }
예제 #9
0
        public bool PromptUserLogin()
        {
            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;

            dlg.Reset();
            dlg.SetHeading(Translation.SelectUser);

            if (CurrentUser != null)
            {
                string msgCurUser = string.Format(Translation.CurrentUser, CurrentUser.Username);

                dlg.Add(msgCurUser);
                dlg.Add("--------");
                dlg.Add(">> " + Translation.LogOut);
            }

            List <JMMUser> allUsers = ShokoServerHelper.GetAllUsers();

            foreach (JMMUser user in allUsers)
            {
                dlg.Add(user.Username);
            }

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

            if (selectedLabel < 0)
            {
                return(false);
            }
            if (CurrentUser != null)
            {
                selectedLabel = selectedLabel - 3;
            }

            if (dlg.SelectedLabelText == ">> " + Translation.LogOut)
            {
                LogOut(true);
                return(false);
            }
            JMMUser selUser = allUsers[selectedLabel];


            BaseConfig.MyAnimeLog.Write("Selected user label: " + selectedLabel);

            // try and auth user with a blank password

            bool   authed   = AuthenticateUser(selUser.Username, "");
            string password = "";

            while (!authed)
            {
                // prompt user for a password
                if (Utils.DialogText(ref password, true, GUIWindowManager.ActiveWindow))
                {
                    authed = AuthenticateUser(selUser.Username, password);
                    if (!authed)
                    {
                        Utils.DialogMsg(Translation.Error, Translation.IncorrectPasswordTryAgain);
                    }
                }
                else
                {
                    return(false);
                }
            }

            SetCurrentUser(selUser);

            return(true);
        }
예제 #10
0
        private void ShowCharacters()
        {
            GUIControl.ClearControl(GetID, m_Facade.GetID);

            if (dummyMainCharExists != null)
            {
                dummyMainCharExists.Visible = false;
            }
            if (dummyMainActorExists != null)
            {
                dummyMainActorExists.Visible = false;
            }
            if (dummySeriesExists != null)
            {
                dummySeriesExists.Visible = false;
            }

            BaseConfig.MyAnimeLog.Write("CharWindow.GlobalSeriesID = {0}", MainWindow.GlobalSeriesID.ToString());

            charList.Clear();

            if (serMain?.Anime == null)
            {
                ClearGUIProperty(GuiProperty.Title);
                ClearGUIProperty(GuiProperty.Character_Name);
                ClearGUIProperty(GuiProperty.Character_KanjiName);
                ClearGUIProperty(GuiProperty.Actor_Name);
                ClearGUIProperty(GuiProperty.Actor_KanjiName);
                ClearGUIProperty(GuiProperty.Character_CharacterCount);
                return;
            }
            serMain = ShokoServerHelper.GetSeries(MainWindow.GlobalSeriesID);
            if (serMain != null)
            {
                mainAnime = serMain.Anime;
            }
            else
            {
                return;
            }

            if (mainAnime == null)
            {
                return;
            }
            SetGUIProperty(GuiProperty.Character_Main_Title, mainAnime.FormattedTitle);

            charList = mainAnime.Characters;
            if (dummyCharactersExist != null)
            {
                dummyCharactersExist.Visible = charList.Count > 0;
            }
            SetGUIProperty(GuiProperty.Character_CharacterCount, charList.Count.ToString(Globals.Culture));
            SetGUIProperty(GuiProperty.Title, serMain.SeriesName);

            string imagePathNoPicture = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_blankchar.png";

            foreach (CL_AniDB_Character aniChar in charList)
            {
                string imagePath = imagePathNoPicture;
                if (!string.IsNullOrEmpty(aniChar.GetPosterPath()) && File.Exists(aniChar.GetPosterPath()))
                {
                    imagePath = aniChar.GetPosterPath();
                }

                GUIListItem item = new GUIListItem("");
                item.IconImage       = item.IconImageBig = imagePath;
                item.TVTag           = aniChar;
                item.OnItemSelected += onFacadeItemSelected;
                m_Facade.Add(item);
            }

            if (m_Facade.Count > 0)
            {
                m_Facade.SelectedListItemIndex = 0;

                CL_AniDB_Character aniChar = m_Facade.SelectedListItem.TVTag as CL_AniDB_Character;
                if (aniChar != null)
                {
                    SetCharacterProperties(aniChar);
                }
            }
        }
예제 #11
0
        protected override void OnShowContextMenu()
        {
            GUIListItem currentitem = m_Facade.SelectedListItem;

            if (currentitem == null)
            {
                return;
            }

            if (currentitem.TVTag.GetType() == typeof(VM_AnimeEpisode_User))
            {
                VM_AnimeEpisode_User ep = currentitem.TVTag as VM_AnimeEpisode_User;
                if (ep != null)
                {
                    GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                    if (dlg == null)
                    {
                        return;
                    }

                    dlg.Reset();
                    dlg.SetHeading(ep.EpisodeNumberAndName);
                    dlg.Add("Mark as Watched");
                    dlg.Add("Play Previous Episode");
                    dlg.Add("Go To Episode List");
                    dlg.Add("View Series Info");

                    dlg.DoModal(GUIWindowManager.ActiveWindow);

                    switch (dlg.SelectedLabelText)
                    {
                    case "Mark as Watched":
                        ep.ToggleWatchedStatus(true);
                        LoadData();
                        break;

                    case "Play Previous Episode":
                        if (ep.AnimeSeries == null)
                        {
                            return;
                        }
                        VM_AnimeEpisode_User epPrev = (VM_AnimeEpisode_User)VM_ShokoServer.Instance.ShokoServices.GetPreviousEpisodeForUnwatched(ep.AnimeSeries.AnimeSeriesID,
                                                                                                                                                 VM_ShokoServer.Instance.CurrentUser.JMMUserID);

                        if (epPrev == null)
                        {
                            Utils.DialogMsg("Error", "Previous episode not found");
                            return;
                        }
                        MainWindow.vidHandler.ResumeOrPlay(epPrev);
                        break;

                    case "Go To Episode List":
                        if (ep.AnimeSeries == null)
                        {
                            return;
                        }

                        MainWindow.Breadcrumbs = new List <History>
                        {
                            new History {
                                Selected = GroupFilterHelper.AllGroupsFilter
                            }
                        };

                        // find the group for this series
                        VM_AnimeGroup_User grp = ShokoServerHelper.GetGroup(ep.AnimeSeries.AnimeGroupID);
                        if (grp == null)
                        {
                            BaseConfig.MyAnimeLog.Write("Group not found");
                            return;
                        }
                        MainWindow.ContinueWatching_CurrentSeries = ep.AnimeSeries;

                        MainWindow.Breadcrumbs.Add(new History {
                            Listing = GroupFilterHelper.AllGroupsFilter, Selected = grp
                        });
                        MainWindow.Breadcrumbs.Add(new History {
                            Listing = grp, Selected = MainWindow.ContinueWatching_CurrentSeries
                        });
                        bool foundEpType = false;
                        if (MainWindow.ContinueWatching_CurrentSeries.EpisodeTypesToDisplay.Count == 1)
                        {
                            MainWindow.Breadcrumbs.Add(new History {
                                Listing = MainWindow.ContinueWatching_CurrentSeries, Selected = null
                            });
                        }
                        else
                        {
                            foreach (VM_AnimeEpisodeType anEpType in MainWindow.ContinueWatching_CurrentSeries.EpisodeTypesToDisplay)
                            {
                                if (anEpType.EpisodeType == EpisodeType.Episode)
                                {
                                    MainWindow.Breadcrumbs.Add(new History {
                                        Listing = MainWindow.ContinueWatching_CurrentSeries, Selected = anEpType
                                    });
                                    MainWindow.Breadcrumbs.Add(new History {
                                        Listing = anEpType, Selected = null
                                    });
                                    foundEpType = true;
                                    break;
                                }
                            }

                            if (!foundEpType)
                            {
                                return;
                            }
                        }
                        GUIWindowManager.CloseCurrentWindow();
                        GUIWindowManager.ActivateWindow(Constants.WindowIDs.MAIN, false);
                        return;

                    case "View Series Info":

                        if (ep.AnimeSeries == null)
                        {
                            return;
                        }
                        MainWindow.GlobalSeriesID = ep.AnimeSeries.AnimeSeriesID;
                        GUIWindowManager.ActivateWindow(Constants.WindowIDs.ANIMEINFO, false);

                        break;
                    }
                }
            }
        }
예제 #12
0
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            MainMenu menu = new MainMenu();

            menu.Add(btnAddTag, () =>
            {
                string tag = Utils.PromptSelectTag("");
                if (!MainWindow.RandomWindow_SeriesTags.Contains(tag, StringComparer.InvariantCultureIgnoreCase))
                {
                    MainWindow.RandomWindow_SeriesTags.Add(tag);
                    SetDisplayDetails();
                }
            });
            menu.Add(btnEpisodeAddTag, () =>
            {
                string tag = Utils.PromptSelectTag("");
                if (!MainWindow.RandomWindow_EpisodeTags.Contains(tag, StringComparer.InvariantCultureIgnoreCase))
                {
                    MainWindow.RandomWindow_EpisodeTags.Add(tag);
                    SetDisplayDetails();
                }
            });
            menu.Add(btnClearTags, () =>
            {
                MainWindow.RandomWindow_SeriesTags.Clear();
                SetDisplayDetails();
            });
            menu.Add(btnEpisodeClearTags, () =>
            {
                MainWindow.RandomWindow_EpisodeTags.Clear();
                SetDisplayDetails();
            });
            menu.Add(btnAllAnyTags, () =>
            {
                MainWindow.RandomWindow_SeriesAllTags = !MainWindow.RandomWindow_SeriesAllTags;
                SetDisplayDetails();
            });
            menu.Add(btnEpisodeAllAnyTags, () =>
            {
                MainWindow.RandomWindow_EpisodeAllTags = !MainWindow.RandomWindow_EpisodeAllTags;
                SetDisplayDetails();
            });
            menu.Add(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;
                btnRandom.IsFocused = true;
                LoadData();
            });
            menu.Add(btnSwitchSeries, () =>
            {
                btnSwitchSeries.IsFocused          = false;
                btnRandom.IsFocused                = true;
                MainWindow.RandomWindow_RandomType = RandomObjectType.Series;
                LoadData();
            });
            menu.Add(btnSwitchEpisode, () =>
            {
                btnSwitchEpisode.IsFocused         = false;
                btnRandom.IsFocused                = true;
                MainWindow.RandomWindow_RandomType = RandomObjectType.Episode;
                LoadData();
            });
            menu.AddFunc(btnPlayEpisode, () =>
            {
                if (MainWindow.RandomWindow_CurrentEpisode == null)
                {
                    return(false);
                }
                MainWindow.vidHandler.ResumeOrPlay(MainWindow.RandomWindow_CurrentEpisode);
                return(true);
            });
            menu.AddFunc(btnEpisodeList, () =>
            {
                if (MainWindow.RandomWindow_CurrentSeries == null)
                {
                    return(false);
                }
                MainWindow.Breadcrumbs = new List <History>
                {
                    new History {
                        Selected = GroupFilterHelper.AllGroupsFilter
                    }
                };

                // find the group for this series
                VM_AnimeGroup_User grp = ShokoServerHelper.GetGroup(MainWindow.RandomWindow_CurrentSeries.AnimeGroupID);
                if (grp == null)
                {
                    BaseConfig.MyAnimeLog.Write("Group not found");
                    return(false);
                }
                MainWindow.Breadcrumbs.Add(new History {
                    Listing = GroupFilterHelper.AllGroupsFilter, Selected = grp
                });
                MainWindow.Breadcrumbs.Add(new History {
                    Listing = grp, Selected = MainWindow.RandomWindow_CurrentSeries
                });
                bool foundEpType = false;
                if (MainWindow.RandomWindow_CurrentSeries.EpisodeTypesToDisplay.Count == 1)
                {
                    MainWindow.Breadcrumbs.Add(new History {
                        Listing = MainWindow.RandomWindow_CurrentSeries, Selected = null
                    });
                }
                else
                {
                    foreach (VM_AnimeEpisodeType anEpType in MainWindow.RandomWindow_CurrentSeries.EpisodeTypesToDisplay)
                    {
                        if (anEpType.EpisodeType == enEpisodeType.Episode)
                        {
                            MainWindow.Breadcrumbs.Add(new History {
                                Listing = MainWindow.RandomWindow_CurrentSeries, Selected = anEpType
                            });
                            MainWindow.Breadcrumbs.Add(new History {
                                Listing = anEpType, Selected = null
                            });
                            foundEpType = true;
                            break;
                        }
                    }

                    if (!foundEpType)
                    {
                        return(false);
                    }
                }
                GUIWindowManager.CloseCurrentWindow();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.MAIN, false);
                return(true);
            });
            if (menu.Check(control))
            {
                return;
            }
            base.OnClicked(controlId, control, actionType);
        }
예제 #13
0
        private void LoadData(int step, DateTime monthNow, bool special = false)
        {
            BaseConfig.MyAnimeLog.Write("LoadData Step: " + step + " Month: " + monthNow);

            // find the anime for this month
            colAnime = ShokoServerHelper.GetAnimeForMonthYear(monthNow.Month, monthNow.Year);

            dummyAnyAnimeForMonth.Visible = ((colAnime.Count > 0) || (m_Facade.Count > 0));


            // now sort the groups by air date

            if (step == -1)
            {
                colAnime = colAnime.OrderByDescending(a => a.AirDate).ToList();
            }
            else
            {
                colAnime = colAnime.OrderBy(a => a.AirDate).ToList();
            }

            //BaseConfig.MyAnimeLog.Write(monthNow.ToString("MMM yyyy").ToUpper());
            if (m_Facade.Count == 0)
            {
                GUIControl.ClearControl(GetID, m_Facade.GetID);
                m_Facade.CurrentLayout = GUIFacadeControl.Layout.Filmstrip;
            }

            VM_AniDB_Anime selanime = null;

            if (m_Facade.Count > 0)
            {
                selanime = (VM_AniDB_Anime)m_Facade.SelectedListItem.TVTag;
            }

            int selIndex = 0;

            foreach (VM_AniDB_Anime anime in colAnime)
            {
                //BaseConfig.MyAnimeLog.Write(anime.ToString());

                string imagePath = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_question_poster.png";
                if (anime.DefaultPosterPath.Trim().Length > 0)
                {
                    if (File.Exists(anime.DefaultPosterPath))
                    {
                        imagePath = anime.DefaultPosterPath;
                    }
                }

                if ((anime.AnimeID == MainWindow.GlobalSeriesID) && (m_Facade.Count == 0))
                {
                    selanime = anime;
                }


                GUIListItem item = new GUIListItem();
                item.IconImage       = item.IconImageBig = imagePath;
                item.TVTag           = anime;
                item.OnItemSelected += onFacadeItemSelected;
                if (step == -1)
                {
                    m_Facade.Insert(0, item);
                }
                else
                {
                    m_Facade.Add(item);
                }
            }

            if ((m_Facade.Count > 0) && (selanime != null))
            {
                //BaseConfig.MyAnimeLog.Write("selIndex: {0}", selIndex.ToString());

                for (int x = 0; x < m_Facade.Count; x++)
                {
                    if ((m_Facade.FilmstripLayout.ListItems[x].TVTag) == selanime)
                    {
                        selIndex = x;
                        break;
                    }
                }
                if (special) //hack
                {
                    m_Facade.OnAction(new MediaPortal.GUI.Library.Action(MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_LEFT, 0, 0));
                    m_Facade.OnAction(new MediaPortal.GUI.Library.Action(MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_RIGHT, 0, 0));
                }

                m_Facade.SelectedListItemIndex = selIndex;

                VM_AniDB_Anime anime = m_Facade.SelectedListItem.TVTag as VM_AniDB_Anime;
                if (anime != null)
                {
                    SetAnime(anime);
                }
            }
            if (step == 0)
            {
                LoadData(-1, monthNow.AddMonths(-1), true);
            }
        }
예제 #14
0
        public List <string> GetParms()
        {
            List <string> parms = new List <string>();

            if (SearchType == DownloadSearchType.Episode)
            {
                VM_AnimeEpisode_User ep = (VM_AnimeEpisode_User)SearchParameter;

                VM_AnimeSeries_User series = ShokoServerHelper.GetSeries(ep.AnimeSeriesID);
                if (series == null)
                {
                    return(parms);
                }

                VM_AniDB_Anime anime = series.Anime;
                if (anime == null)
                {
                    return(parms);
                }

                // only use the first 2 words of the anime's title
                string[] titles = anime.MainTitle.Split(' ');
                int      i      = 0;
                foreach (string s in titles)
                {
                    i++;
                    parms.Add(s.Trim());
                    if (i == 2)
                    {
                        break;
                    }
                }

                parms.Add(ep.EpisodeNumber.ToString().PadLeft(2, '0'));
            }

            if (SearchType == DownloadSearchType.Series)
            {
                VM_AniDB_Anime anime = (VM_AniDB_Anime)SearchParameter;

                // only use the first 2 words of the anime's title
                string[] titles = anime.MainTitle.Split(' ');
                int      i      = 0;
                foreach (string s in titles)
                {
                    i++;
                    parms.Add(s.Trim());
                    if (i == 2)
                    {
                        break;
                    }
                }
            }

            if (SearchType == DownloadSearchType.Manual)
            {
                string[] titles = SearchParameter.ToString().Split(' ');
                foreach (string s in titles)
                {
                    parms.Add(s.Trim());
                }
            }

            return(parms);
        }
예제 #15
0
        private void ShowPosters()
        {
            GUIControl.ClearControl(this.GetID, m_Facade.GetID);
            List <PosterContainer> allPosters = new List <PosterContainer>();

            string displayname = "";

            VM_AnimeSeries_User ser = ShokoServerHelper.GetSeries(MainWindow.GlobalSeriesID);

            if (ser != null)
            {
                displayname = ser.SeriesName;
                if (ser.CrossRefAniDBTvDBV2 != null && ser.CrossRefAniDBTvDBV2.Count > 0)
                {
                    AnimeID = ser.CrossRefAniDBTvDBV2[0].AnimeID;
                }
            }
            else
            {
                return;
            }
            BaseConfig.MyAnimeLog.Write("ShowPosters for {0} - {1}", displayname, AnimeID);

            foreach (PosterContainer pstr in ser.Anime.AniDB_AnimeCrossRefs.AllPosters)
            {
                if (!File.Exists(pstr.FullImagePath))
                {
                    continue;
                }

                allPosters.Add(pstr);
            }

            GUIListItem item = null;

            foreach (PosterContainer poster in allPosters)
            {
                item                 = new GUIListItem();
                item.IconImage       = item.IconImageBig = poster.FullImagePath;
                item.TVTag           = poster;
                item.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected);
                m_Facade.Add(item);
            }

            if (m_Facade.Count > 0)
            {
                m_Facade.SelectedListItemIndex = 0;

                // Work around for Filmstrip not allowing to programmatically select item
                if (m_Facade.CurrentLayout == GUIFacadeControl.Layout.Filmstrip)
                {
                }

                PosterContainer selectedPoster = m_Facade.SelectedListItem.TVTag as PosterContainer;
                if (selectedPoster != null)
                {
                    SetPosterProperties(selectedPoster);
                }

                GUIControl.FocusControl(GetID, 50);
            }
        }