public AttachedAlbumViewModel(string title, AttachedAlbum attachedAlbumModel, AttachedImageViewModel[] thumbnailImages, ImageSource largeImage)
 {
     _title = title;
     _largeImage = largeImage;
     _thumbnailImages = thumbnailImages;
     _attachedAlbumModel = attachedAlbumModel;
     _linkUrl = attachedAlbumModel.LinkUrl;
     _width = largeImage.Width;
     _height = largeImage.Height;
 }
示例#2
0
 public static async Task<AttachedAlbumViewModel> Create(AttachedAlbum attachedAlbumModel)
 {
     var title = attachedAlbumModel.Album.Name;
     var thumbImgs = new List<AttachedImageViewModel>();
     var downDatas = await Task.WhenAll(attachedAlbumModel.Pictures
         .Select(async imgInf => new {
             Info = imgInf,
             Data = await DataCacheDictionary.DownloadImage(new Uri(imgInf.Image.ImageUrl.Replace("$SIZE_SEGMENT", "s70"))).ConfigureAwait(false) }))
         .ConfigureAwait(false);
     var largeImg = await DataCacheDictionary.DownloadImage(new Uri(attachedAlbumModel.Pictures.First().Image.ImageUrl.Replace("$SIZE_SEGMENT", "w640-h480")));
     foreach (var jobInf in downDatas)
         thumbImgs.Add(new AttachedImageViewModel(jobInf.Info, jobInf.Data));
     return new AttachedAlbumViewModel(title, attachedAlbumModel, thumbImgs.ToArray(), largeImg);
 }