示例#1
0
        public void ProcessTapOnThumbsItem()
        {
            ThumbsItem thumbsItem = this.VirtualizableChildren.FirstOrDefault <IVirtualizable>((Func <IVirtualizable, bool>)(v => v is ThumbsItem)) as ThumbsItem;

            if (thumbsItem == null)
            {
                return;
            }
            thumbsItem.Image_Tap(null);
        }
示例#2
0
        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));
            }
        }
示例#3
0
 private double CreatePhotoVideoAlbum(double topMargin)
 {
     topMargin += 8.0;
     if (this._thumbsItem == null)
     {
         this._thumbsItem = new ThumbsItem(this._isCommentAttachments || this._isMessage ? this._verticalWidth : 480.0, new Thickness(0.0, topMargin, 0.0, 0.0), this._attachments, this._friendsOnly, this._itemId, this._isCommentAttachments, this._isMessage, this._isHorizontal, this._horizontalWidth, 0.0);
         this.VirtualizableChildren.Add((IVirtualizable)this._thumbsItem);
     }
     else
     {
         this._thumbsItem.IsHorizontal = this._isHorizontal;
         this._thumbsItem.Margin       = new Thickness(0.0, topMargin, 0.0, 0.0);
     }
     return(this._thumbsItem.FixedHeight);
 }
示例#4
0
        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();
            }
        }
示例#5
0
        private void GenerateVirtualizableChildren()
        {
            int       date = this._newsPost.NewsItem.created != 0 ? this._newsPost.NewsItem.created : this._newsPost.NewsItem.date;
            double    width1;
            Thickness margin1;

            if (this._fullScreen)
            {
                width1 = this.Width - 48.0;
                // ISSUE: explicit reference operation
                margin1 = new Thickness(24.0, 32.0, 24.0, 0.0);
            }
            else
            {
                width1 = this.Width;
                // ISSUE: explicit reference operation
                margin1 = new Thickness();
            }
            Action moreOptionsTapCallback = null;

            if (this._menuItems != null && this._menuItems.Count > 0)
            {
                // ISSUE: method pointer
                moreOptionsTapCallback = new Action(this.OnMoreOptionsTap);
            }
            this._headerItem = new UserOrGroupHeaderItem(width1, margin1, this.IsGroup, date, this.FromUser, this.FromGroup, this.ExtraText, PostIconType.None, PostSourcePlatform.None, moreOptionsTapCallback, null, "");
            base.VirtualizableChildren.Add((IVirtualizable)this._headerItem);
            Thickness thickness = new Thickness();
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            double num1 = thickness.Top + this._marginBetweenElements + this._headerItem.FixedHeight + 2.0;

            thickness.Top = num1;
            double width2 = this.Width;
            string str    = this._newsPost.NewsItem.from_id == 0L || this._newsPost.NewsItem.id <= 0L ? "" : string.Format("{0}_{1}", this._newsPost.NewsItem.from_id, this._newsPost.NewsItem.id);

            if (this._photo != null)
            {
                double            width3      = width2;
                Thickness         margin2     = thickness;
                List <Attachment> attachments = new List <Attachment>();
                Attachment        attachment  = new Attachment();
                attachment.type = "photo";
                Photo photo = this._photo;
                attachment.photo = photo;
                attachments.Add(attachment);
                // ISSUE: variable of the null type

                string itemId          = str;
                int    num2            = 0;
                int    num3            = 0;
                int    num4            = 0;
                int    num5            = 0;
                double horizontalWidth = 0.0;
                int    num6            = 0;
                int    num7            = 0;
                string hyperlinkId     = "";
                // ISSUE: variable of the null type

                // ISSUE: variable of the null type

                int             num8            = 0;
                AttachmentsItem attachmentsItem = new AttachmentsItem(width3, margin2, attachments, null, itemId, num2 != 0, num3 != 0, num4 != 0, num5 != 0, horizontalWidth, num6 != 0, num7 != 0, hyperlinkId, null, null, num8 != 0);
                base.VirtualizableChildren.Add((IVirtualizable)attachmentsItem);
                // ISSUE: explicit reference operation
                this._fixedHeight = ((Thickness)@thickness).Top + attachmentsItem.FixedHeight;
            }
            else if (this._video != null)
            {
                double            width3      = width2;
                Thickness         margin2     = thickness;
                List <Attachment> attachments = new List <Attachment>();
                Attachment        attachment  = new Attachment();
                attachment.type = "video";
                VKClient.Common.Backend.DataObjects.Video video = this._video;
                attachment.video = video;
                attachments.Add(attachment);
                // ISSUE: variable of the null type

                string itemId          = str;
                int    num2            = 0;
                int    num3            = 0;
                int    num4            = 0;
                int    num5            = 0;
                double horizontalWidth = 0.0;
                int    num6            = 0;
                int    num7            = 0;
                string hyperlinkId     = "";
                // ISSUE: variable of the null type

                // ISSUE: variable of the null type

                int             num8            = 0;
                AttachmentsItem attachmentsItem = new AttachmentsItem(width3, margin2, attachments, null, itemId, num2 != 0, num3 != 0, num4 != 0, num5 != 0, horizontalWidth, num6 != 0, num7 != 0, hyperlinkId, null, null, num8 != 0);
                base.VirtualizableChildren.Add((IVirtualizable)attachmentsItem);
                // ISSUE: explicit reference operation
                this._fixedHeight = ((Thickness)@thickness).Top + attachmentsItem.FixedHeight;
            }
            else
            {
                bool flag = this._newsPost.NewsItem.post_type == "photo" || this._newsPost.NewsItem.post_type == "wall_photo";
                // ISSUE: explicit reference operation
                // ISSUE: explicit reference operation
                ThumbsItem thumbsItem = new ThumbsItem(width2, new Thickness(((Thickness)@thickness).Left, ((Thickness)@thickness).Top, 0.0, 0.0), new NewsPhotosInfo()
                {
                    SourceId = this._newsPost.NewsItem.source_id, Date = this._newsPost.NewsItem.date, NewsType = (NewsPhotosInfo.NewsPhotoType)(flag ? 0 : 1), Count = flag ? this._newsPost.NewsItem.PhotosCount : this._newsPost.NewsItem.PhotoTagsCount, Photos = flag ? this._newsPost.NewsItem.Photos : this._newsPost.NewsItem.Photo_tags
                });
                base.VirtualizableChildren.Add((IVirtualizable)thumbsItem);
                // ISSUE: explicit reference operation
                this._fixedHeight = ((Thickness)@thickness).Top + thumbsItem.FixedHeight;
                this._fixedHeight = this._fixedHeight + 31.0;
            }
        }
示例#6
0
 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();
     }
 }
示例#7
0
 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);
         }
     }
 }