コード例 #1
0
        private CatalogEntry CreateEntryFromGoogle(GoogleBooksApi.VolumeInfo source)
        {
            List <string> ids = new List <string>();

            if (!source.IndustryIdentifiers.IsNullOrEmpty())
            {
                foreach (var i in source.IndustryIdentifiers)
                {
                    ids.Add(i.Identifier);
                }
            }
            List <string> genres = new List <string>();

            if (!source.Categories.IsNullOrEmpty())
            {
                foreach (var g in source.Categories)
                {
                    genres.Add(g);
                }
            }
            CatalogEntry res = new CatalogEntry(
                source.Title,
                source.Subtitle,
                ids,
                source.Publisher,
                source.PublishedDateAsString,
                source.PageCount,
                source.Description,
                txtShelf.Text,
                ageRestrict.MinAge,
                ageRestrict.MaxAge,
                gradeRestrict.MinGrade,
                gradeRestrict.MaxGrade,
                genres.ToArray()
                );

            if (!source.Authors.IsNullOrEmpty())
            {
                foreach (var a in source.Authors)
                {
                    res.AddAuthor(a);
                }
            }
            return(res);
        }