Пример #1
0
        internal PicasaAlbumInfo(PicasaEntry album, PicasaService picasaService)
        {
            if (picasaService == null)
                throw new ArgumentNullException("picasaService", "picasaService is null.");
            if (album == null)
                throw new ArgumentNullException("album", "album is null.");

            _picasaService = picasaService;
            _album = album;

            NumPhotos = Int32.Parse(_album.GetPhotoExtensionValue(GPhotoNameTable.NumPhotos));
            RemainingPhotos = Int32.Parse(_album.GetPhotoExtensionValue(GPhotoNameTable.NumPhotosRemaining));
            Title = _album.Title.Text;
            if (_album.Media.Thumbnails != null && _album.Media.Thumbnails.Count > 0)
                AlbumCover = new Bitmap(_picasaService.Query(new Uri((string)_album.Media.Thumbnails[0].Attributes["url"])));
            Id = _album.GetPhotoExtensionValue(GPhotoNameTable.Id);
        }
        private string GetPreviewUrl(PicasaEntry photo)
        {
            int originalWidth = int.Parse(photo.GetPhotoExtensionValue(GPhotoNameTable.Width));
            int originalHeight = int.Parse(photo.GetPhotoExtensionValue(GPhotoNameTable.Height));

            int size = originalWidth > originalHeight
                     ? Math.Min(this.previewWidth, originalWidth)
                     : Math.Min(this.previewHeight, originalHeight);

            string output = GetImageUrl(photo, size.ToString());

            return output;
        }
        private string GetPhotoExtensions(PicasaEntry photo)
        {
            StringBuilder info = new StringBuilder();

            foreach (var extension in photo.ExtensionElements)
            {
                info.AppendLine(extension.XmlName + " = " + photo.GetPhotoExtensionValue(extension.XmlName) + HTML_BREAK);
            }

            string output = info.ToString();

            return output;
        }
Пример #4
0
 public AlbumInfo(PicasaEntry album)
 {
     this.FeedUri = album.FeedUri;
     this.Title = album.Title.Text + " [" + album.GetPhotoExtensionValue(GPhotoNameTable.NumPhotos) + "]";
     this.Url = album.AlternateUri.Content;
 }
Пример #5
0
 public void getPhotoExtensionValueTest()
 {
     PicasaEntry target = new PicasaEntry(); // TODO: Initialize to an appropriate value
     string extension = GPhotoNameTable.Photoid;
     string newValue = "theid";
     string actual = null; 
     target.SetPhotoExtensionValue(extension, newValue);
     actual = target.GetPhotoExtensionValue(extension);
     Assert.AreEqual(newValue, actual);
 }