Esempio n. 1
0
        public static List <AniDB_Anime_RelationVM> GetRelatedAnime(int animeID)
        {
            List <AniDB_Anime_RelationVM> allRelations = new List <AniDB_Anime_RelationVM>();

            try
            {
                List <JMMServerBinary.Contract_AniDB_Anime_Relation> links = JMMServerVM.Instance.clientBinaryHTTP.GetRelatedAnimeLinks(animeID,
                                                                                                                                        JMMServerVM.Instance.CurrentUser.JMMUserID);

                List <AniDB_Anime_RelationVM> tempList = new List <AniDB_Anime_RelationVM>();
                foreach (JMMServerBinary.Contract_AniDB_Anime_Relation link in links)
                {
                    AniDB_Anime_RelationVM rel = new AniDB_Anime_RelationVM();
                    rel.Populate(link);
                    allRelations.Add(rel);
                }

                List <SortPropOrFieldAndDirection> sortCriteria = new List <SortPropOrFieldAndDirection>();
                sortCriteria.Add(new SortPropOrFieldAndDirection("SortPriority", false, SortType.eInteger));
                allRelations = Sorting.MultiSort <AniDB_Anime_RelationVM>(allRelations, sortCriteria);

                return(allRelations);
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write(ex.ToString());
            }
            return(allRelations);
        }
Esempio n. 2
0
        private void SetAnime(AniDB_Anime_RelationVM ra)
        {
            AniDB_AnimeVM anime = ra.AniDB_Anime;

            setGUIProperty("Related.Title", ra.DisplayName);
            setGUIProperty("Related.Relationship", ra.RelationType);
            setGUIProperty("Related.Episodes", "-");
            setGUIProperty("Related.Year", "-");
            setGUIProperty("Related.Description", "-");
            setGUIProperty("Related.Genre", "-");
            setGUIProperty("Related.GenreShort", "-");
            setGUIProperty("Related.Status", "-");

            if (dummyHasSeries != null) dummyHasSeries.Visible = false;
            if (dummyHasSeries != null && ra.AnimeSeries != null) dummyHasSeries.Visible = false;

            if (anime != null)
            {
                setGUIProperty("Related.Episodes", anime.EpisodeCountNormal.ToString() + " (" + anime.EpisodeCountSpecial.ToString() + " Specials)");
                setGUIProperty("Related.Year", anime.AirDateAsString);
                setGUIProperty("Related.Description", anime.ParsedDescription);
                setGUIProperty("Related.Genre", anime.CategoriesFormatted);
                setGUIProperty("Related.GenreShort", anime.CategoriesFormattedShort);
            }

            if (ra.AnimeSeries != null)
            {
                if (ra.AnimeSeries.MissingEpisodeCount > 0)
                    setGUIProperty("Related.Status", "Collecting");
                else
                    setGUIProperty("Related.Status", "All Episodes Available");
            }
            else
                setGUIProperty("Related.Status", "Not In My Collection");
        }
Esempio n. 3
0
        public static List<AniDB_Anime_RelationVM> GetRelatedAnime(int animeID)
        {
            List<AniDB_Anime_RelationVM> allRelations = new List<AniDB_Anime_RelationVM>();
            try
            {
                List<JMMServerBinary.Contract_AniDB_Anime_Relation> links = JMMServerVM.Instance.clientBinaryHTTP.GetRelatedAnimeLinks(animeID,
                    JMMServerVM.Instance.CurrentUser.JMMUserID);

                List<AniDB_Anime_RelationVM> tempList = new List<AniDB_Anime_RelationVM>();
                foreach (JMMServerBinary.Contract_AniDB_Anime_Relation link in links)
                {
                    AniDB_Anime_RelationVM rel = new AniDB_Anime_RelationVM();
                    rel.Populate(link);
                    allRelations.Add(rel);
                }

                List<SortPropOrFieldAndDirection> sortCriteria = new List<SortPropOrFieldAndDirection>();
                sortCriteria.Add(new SortPropOrFieldAndDirection("SortPriority", false, SortType.eInteger));
                allRelations = Sorting.MultiSort<AniDB_Anime_RelationVM>(allRelations, sortCriteria);

                return allRelations;
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write(ex.ToString());
            }
            return allRelations;
        }
        private void SetAnime(AniDB_Anime_RelationVM ra)
        {
            AniDB_AnimeVM anime = ra.AniDB_Anime;
            ClearGUIProperty(GuiProperty.Related_Status);

            if (dummyHasSeries != null) dummyHasSeries.Visible = false;
            if (dummyHasSeries != null && ra.AnimeSeries != null) dummyHasSeries.Visible = false;
            if (anime != null)
            {
                SetGUIProperty(GuiProperty.Related_Title, anime.MainTitle);
                SetGUIProperty(GuiProperty.Related_Episodes, anime.EpisodeCountNormal.ToString(Globals.Culture) + " (" + anime.EpisodeCountSpecial.ToString(Globals.Culture) + " " + Translation.Specials + ")");
                SetGUIProperty(GuiProperty.Related_Year, anime.AirDateAsString);
                SetGUIProperty(GuiProperty.Related_Description, anime.ParsedDescription);
                SetGUIProperty(GuiProperty.Related_Genre, anime.TagsFormatted);
                SetGUIProperty(GuiProperty.Related_GenreShort, anime.TagsFormattedShort);

                if (string.IsNullOrEmpty(ra.RelationType))
                    SetGUIProperty(GuiProperty.Related_Relationship, string.Empty);
                else
                    SetGUIProperty(GuiProperty.Related_Relationship, $"({ra.RelationType})");
            }
            else
            {
                ClearGUIProperty(GuiProperty.Related_Title);
                ClearGUIProperty(GuiProperty.Related_Episodes);
                ClearGUIProperty(GuiProperty.Related_Year);
                ClearGUIProperty(GuiProperty.Related_Description);
                ClearGUIProperty(GuiProperty.Related_Genre);
                ClearGUIProperty(GuiProperty.Related_GenreShort);
                ClearGUIProperty(GuiProperty.Related_Relationship);
            }

            SetGUIProperty(GuiProperty.Related_Status, ra.AnimeSeries != null ? (ra.AnimeSeries.MissingEpisodeCount > 0 ? Translation.Collecting : Translation.AllEpisodesAvailable) : Translation.NotInMyCollection);
        }