Пример #1
0
        public PagedList <AlbumSummary> ListAlbums(int page, int pageSize)
        {
            var query = new AlbumQuery(PicasaQuery.CreatePicasaUri(PicasaConfiguration.Settings.Gallery.User))
            {
                Thumbsize        = PicasaConfiguration.Settings.Pictures.ThumbnailSize.ToString(),
                StartIndex       = (page - 1) * pageSize + 1,
                NumberToRetrieve = pageSize
            };

            var feed  = GetPicasaFeed(query);
            var items = from PicasaEntry pictureEntry in feed.Entries select PicasaDataMapper.MapPicasaAlbum(pictureEntry);

            items = items.Where(item => item.Title != "Profile Photos" && item.Title != "Scrapbook Photos");

            return(new PagedList <AlbumSummary>(items, Utils.CalculatePageNumber(feed.StartIndex, feed.ItemsPerPage), feed.ItemsPerPage, Utils.CalculatePageNumber(feed.TotalResults, feed.ItemsPerPage)));
        }
Пример #2
0
        public Album GetAlbum(string albumID)
        {
            var query = new PhotoQuery(PicasaQuery.CreatePicasaUri(PicasaConfiguration.Settings.Gallery.User, albumID))
            {
                Thumbsize       = PicasaConfiguration.Settings.Pictures.ThumbnailSize.ToString(),
                ExtraParameters = PicasaConfiguration.Settings.Pictures.MaximumImageSize.HasValue ?
                                  ("imgmax=" + PicasaConfiguration.Settings.Pictures.MaximumImageSize.Value.ToString()) : ""
            };

            var feed = GetPicasaFeed(query);

            return(new Album
            {
                Summary = PicasaDataMapper.MapPicasaAlbum(feed, albumID),
                Pictures = from PicasaEntry pictureEntry in feed.Entries select PicasaDataMapper.MapPicasaImage(pictureEntry)
            });
        }