Esempio n. 1
0
        private double CreateGeneric(double topMargin)
        {
            topMargin += this._isMessage ? 0.0 : 8.0;
            double top             = topMargin;
            int    num1            = 0;
            double num2            = this._isMessage || this._isCommentAttachments ? 16.0 : 0.0;
            double width           = this._verticalWidth + num2 * 2.0;
            double horizontalWidth = this._horizontalWidth + num2 * 2.0;

            if (this._genericItemsList != null)
            {
                foreach (GenericAttachmentItem genericItems in this._genericItemsList)
                {
                    genericItems.Margin       = new Thickness(-num2, top, -num2, 0.0);
                    genericItems.IsHorizontal = this.IsHorizontal;
                    top += genericItems.FixedHeight;
                    ++num1;
                }
            }
            else
            {
                this._genericItemsList = new List <GenericAttachmentItem>();
                foreach (Attachment attachment in this._attachments.Where <Attachment>((Func <Attachment, bool>)(a =>
                {
                    if (a.doc != null && !new DocumentHeader(a.doc, 0, false).HasThumbnail || (a.note != null || a.Page != null))
                    {
                        return(true);
                    }
                    if (a.link != null)
                    {
                        return(this._linkItem == null);
                    }
                    return(false);
                })))
                {
                    GenericAttachmentItem genericAttachmentItem = new GenericAttachmentItem(width, new Thickness(-num2, top, -num2, 0.0), attachment, this._isHorizontal, horizontalWidth, this._hyperlinkId);
                    this.VirtualizableChildren.Add((IVirtualizable)genericAttachmentItem);
                    this._genericItemsList.Add(genericAttachmentItem);
                    top += genericAttachmentItem.FixedHeight;
                    ++num1;
                }
            }
            if (num1 <= 0)
            {
                return(0.0);
            }
            return(top - topMargin);
        }
Esempio n. 2
0
        private double CreateProduct(double topMargin)
        {
            if (this._product == null)
            {
                return(0.0);
            }
            topMargin += this._isMessage ? 0.0 : 8.0;
            double num             = this._isMessage || this._isCommentAttachments ? 16.0 : 0.0;
            double width           = this._verticalWidth + num * 2.0;
            double horizontalWidth = this._horizontalWidth + num * 2.0;

            if (this._isMessage)
            {
                if (this._productSmallItem != null)
                {
                    this._productSmallItem.Margin       = new Thickness(-num, topMargin, -num, 0.0);
                    this._productSmallItem.IsHorizontal = this.IsHorizontal;
                }
                else
                {
                    this._productSmallItem = new GenericAttachmentItem(width, new Thickness(-num, topMargin, -num, 0.0), this._attachments.FirstOrDefault <Attachment>((Func <Attachment, bool>)(a => a.market != null)), this._isHorizontal, horizontalWidth, this._hyperlinkId);
                    this.VirtualizableChildren.Add((IVirtualizable)this._productSmallItem);
                }
                return(this._productSmallItem.FixedHeight);
            }
            if (this._productItem != null)
            {
                this._productItem.Margin = new Thickness(-num, topMargin, -num, 0.0);
            }
            else
            {
                Link link = new Link();
                link.title   = this._product.title;
                link.caption = CommonResources.Product;
                link.photo   = new Photo()
                {
                    photo_75 = this._product.thumb_photo
                };
                LinkProduct linkProduct = new LinkProduct(this._product);
                link.product = linkProduct;
                string str = string.Format("http://vk.com/product{0}_{1}", (object)this._product.owner_id, (object)this._product.id);
                link.url          = str;
                this._productItem = this.CreateSnippetItem(link, topMargin);
                this.VirtualizableChildren.Add((IVirtualizable)this._productItem);
            }
            return(this._productItem.FixedHeight);
        }
Esempio n. 3
0
        private double CreateGeneric(double topMargin)
        {
            topMargin += (this._isMessage ? 0.0 : 8.0);
            double num             = topMargin;
            int    num2            = 0;
            double num3            = (this._isMessage || this._isCommentAttachments) ? 16.0 : 0.0;
            double width           = this._verticalWidth + num3 * 2.0;
            double horizontalWidth = this._horizontalWidth + num3 * 2.0;

            if (this._genericItemsList != null)
            {
                using (List <GenericAttachmentItem> .Enumerator enumerator = this._genericItemsList.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        GenericAttachmentItem current = enumerator.Current;
                        current.Margin       = new Thickness(-num3, num, -num3, 0.0);
                        current.IsHorizontal = this.IsHorizontal;
                        num += current.FixedHeight;
                        num2++;
                    }
                    goto IL_17F;
                }
            }
            this._genericItemsList = new List <GenericAttachmentItem>();
            using (IEnumerator <Attachment> enumerator2 = Enumerable.Where <Attachment>(this._attachments, (Attachment a) => (a.doc != null && !a.doc.IsGraffiti && !a.doc.IsVoiceMessage && !new DocumentHeader(a.doc, 0, false, 0L).HasThumbnail) || a.note != null || a.Page != null || (a.link != null && this._linkItem == null)).GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    Attachment            current2 = enumerator2.Current;
                    GenericAttachmentItem genericAttachmentItem = new GenericAttachmentItem(width, new Thickness(-num3, num, -num3, 0.0), current2, this._isHorizontal, horizontalWidth, this._hyperlinkId);
                    base.VirtualizableChildren.Add(genericAttachmentItem);
                    this._genericItemsList.Add(genericAttachmentItem);
                    num += genericAttachmentItem.FixedHeight;
                    num2++;
                }
            }
IL_17F:
            if (num2 <= 0)
            {
                return(0.0);
            }
            return(num - topMargin);
        }