Esempio n. 1
0
        public static PhotoListProviderModel.Photo ToProviderModel(this PhotosetsGetPhotosResponse.PhotoSet.Photo response)
        {
            var photo = new PhotoListProviderModel.Photo()
            {
                DateTaken = TryGetDateTime(response.DateTaken),
                Id        = response.Id,
                Name      = response.Title,
                Secret    = response.Secret,
            };

            var scales = new List <PhotoListProviderModel.Photo.PhotoScale>();

            if (!string.IsNullOrEmpty(response.MediumUrl))
            {
                scales.Add(response.GetPhotoScale(PhotoListProviderModel.Photo.PhotoScale.ScaleType.Medium));
            }
            if (!string.IsNullOrEmpty(response.OriginalUrl))
            {
                scales.Add(response.GetPhotoScale(PhotoListProviderModel.Photo.PhotoScale.ScaleType.Original));
            }
            if (!string.IsNullOrEmpty(response.SmallUrl))
            {
                scales.Add(response.GetPhotoScale(PhotoListProviderModel.Photo.PhotoScale.ScaleType.Small));
            }
            if (!string.IsNullOrEmpty(response.ThumbnailUrl))
            {
                scales.Add(response.GetPhotoScale(PhotoListProviderModel.Photo.PhotoScale.ScaleType.Thumbnail));
            }
            photo.Scales = scales.ToArray();

            return(photo);
        }
Esempio n. 2
0
        private async Task SetPhotoDetails(string photosetId, PhotoListProviderModel.Photo photo)
        {
            var details = await _travelImageProvider.GetPhotoInfo(photosetId, photo.Id, photo.Secret);

            photo.DateTaken    = details.DateTaken;
            photo.Rotation     = details.Rotation;
            photo.Tags         = details.Tags;
            photo.Title        = details.Title;
            photo.PhotoPageUrl = details.PhotoPageUrl;
        }
Esempio n. 3
0
 private static AlbumDomainModel.Photo ToPhoto(this PhotoListProviderModel.Photo photo)
 {
     return(new AlbumDomainModel.Photo
     {
         DateTaken = photo.DateTaken,
         Name = photo.Name,
         Scales = photo.Scales.Select(x => new AlbumDomainModel.Photo.PhotoScale
         {
             Height = x.Height,
             Scale = Enum.Parse <AlbumDomainModel.Photo.PhotoScale.ScaleType>(x.Scale.ToString()),
             Url = x.Url,
             Width = x.Width,
         }).ToArray(),
         Secret = photo.Secret,
         Tags = photo.Tags,
         Rotation = photo.Rotation,
         PhotoPageUrl = photo.PhotoPageUrl,
     });
 }