private void ReadThumbsListFromNewsPhotosInfo() { NewsPhotosInfo newsPhotosInfo = this._newsPhotosInfo; if ((newsPhotosInfo != null ? newsPhotosInfo.Photos : (List <Photo>)null) == null) { return; } this._thumbs.Clear(); foreach (Photo photo in this._newsPhotosInfo.Photos) { this._thumbs.Add(ThumbsItem.ConvertPhotoToThumb(photo, (Attachment)null)); } }
private void ReadThumbsListFromNewsPhotosInfo() { NewsPhotosInfo newsPhotosInfo = this._newsPhotosInfo; if ((newsPhotosInfo != null ? newsPhotosInfo.Photos : null) == null) { return; } this._thumbs.Clear(); List <Photo> .Enumerator enumerator = this._newsPhotosInfo.Photos.GetEnumerator(); try { while (enumerator.MoveNext()) { this._thumbs.Add(ThumbsItem.ConvertPhotoToThumb(enumerator.Current, null)); } } finally { enumerator.Dispose(); } }
private void ReadThumbsListFromAttachments() { if (this._attachments == null) { return; } this._thumbs.Clear(); List <Attachment> .Enumerator enumerator = this._attachments.GetEnumerator(); try { while (enumerator.MoveNext()) { Attachment current = enumerator.Current; ThumbsItem.Thumb thumb1 = (ThumbsItem.Thumb)null; if (current.type == "photo") { Photo photo = current.photo; if (photo != null) { thumb1 = ThumbsItem.ConvertPhotoToThumb(photo, current); } } else if (current.type == "album") { Photo thumb2 = current.album.thumb; if (thumb2 != null) { thumb1 = ThumbsItem.ConvertPhotoToAlbumThumb(thumb2, current); } else { thumb1 = new ThumbsItem.Thumb(current) { Width = this.Width, Height = (double)(int)(this.Width * 2.0 / 3.0) } }; } else if (current.type == "market_album") { Photo photo = current.market_album.photo; if (photo != null) { thumb1 = ThumbsItem.ConvertPhotoToAlbumThumb(photo, current); } else { thumb1 = new ThumbsItem.Thumb(current) { Width = this.Width, Height = (double)(int)(this.Width * 2.0 / 3.0) } }; } else if (current.type == "video") { VKClient.Common.Backend.DataObjects.Video video = current.video; if (video != null) { thumb1 = new ThumbsItem.Thumb(current) { Width = this.Width, Height = (double)(int)(this.Width * 9.0 / 16.0), BigSrc = string.IsNullOrWhiteSpace(video.image_big) ? video.image_medium : video.image_big } } ; } else if (current.type == "doc") { Doc doc = current.doc; if (doc != null && doc.IsVideoGif) { Photo photoPreview = doc.ConvertToPhotoPreview(); thumb1 = new ThumbsItem.Thumb(current) { Width = (double)photoPreview.width, Height = (double)photoPreview.height, BigSrc = photoPreview.src_xbig }; } } if (thumb1 != null) { this._thumbs.Add(thumb1); } } } finally { enumerator.Dispose(); } }
private void ReadThumbsListFromAttachments() { if (this._attachments == null) { return; } this._thumbs.Clear(); foreach (Attachment attachment in this._attachments) { ThumbsItem.Thumb thumb1 = (ThumbsItem.Thumb)null; if (attachment.type == "photo") { Photo photo = attachment.photo; if (photo != null) { thumb1 = ThumbsItem.ConvertPhotoToThumb(photo, attachment); } } else if (attachment.type == "album") { Photo thumb2 = attachment.album.thumb; if (thumb2 != null) { thumb1 = ThumbsItem.ConvertPhotoToAlbumThumb(thumb2, attachment); } else { thumb1 = new ThumbsItem.Thumb(attachment) { Width = this.Width, Height = (double)(int)(this.Width * 2.0 / 3.0) } }; } else if (attachment.type == "market_album") { Photo photo = attachment.market_album.photo; if (photo != null) { thumb1 = ThumbsItem.ConvertPhotoToAlbumThumb(photo, attachment); } else { thumb1 = new ThumbsItem.Thumb(attachment) { Width = this.Width, Height = (double)(int)(this.Width * 2.0 / 3.0) } }; } else if (attachment.type == "video") { VKClient.Common.Backend.DataObjects.Video video = attachment.video; if (video != null) { thumb1 = new ThumbsItem.Thumb(attachment) { Width = this.Width, Height = (double)(int)(this.Width * 9.0 / 16.0), BigSrc = string.IsNullOrWhiteSpace(video.image_big) ? video.image_medium : video.image_big } } ; } else if (attachment.type == "doc") { Doc doc = attachment.doc; if (doc != null && doc.IsVideoGif) { Photo photoPreview = doc.ConvertToPhotoPreview(); thumb1 = new ThumbsItem.Thumb(attachment) { Width = (double)photoPreview.width, Height = (double)photoPreview.height, BigSrc = photoPreview.src_xbig }; } } if (thumb1 != null) { this._thumbs.Add(thumb1); } } }