Exemplo n.º 1
0
        private double GenerateMarket()
        {
            double   num      = 0.0;
            NewsItem newsItem = this._newsItemData.NewsItem;

            if (this._headerItem == null)
            {
                this._headerItem = new UserOrGroupHeaderItem(this.Width, new Thickness(), true, newsItem.date, (User)null, this._newsItemData.Groups.FirstOrDefault <Group>((Func <Group, bool>)(g => g.id == -this._newsItemData.NewsItem.source_id)), "", PostIconType.None, PostSourcePlatform.None, new Action(this.OnMoreOptionsTap), null, "");
                this._headerItem.SetMenu(this.GenerateMenuItems());
                this.VirtualizableChildren.Add((IVirtualizable)this._headerItem);
            }
            this._headerItem.ViewMargin = new Thickness();
            double top = num + (this._headerItem.FixedHeight + 16.0);

            if (this._marketItem == null)
            {
                Product product = new Product()
                {
                    owner_id     = newsItem.owner_id,
                    id           = newsItem.id,
                    title        = newsItem.title,
                    thumb_photo  = newsItem.thumb_photo,
                    availability = newsItem.availability,
                    price        = newsItem.price,
                    category     = newsItem.category
                };
                Link link1 = new Link();
                link1.title   = newsItem.title;
                link1.caption = CommonResources.Product;
                link1.photo   = new Photo()
                {
                    photo_75 = newsItem.thumb_photo
                };
                LinkProduct linkProduct = new LinkProduct(product);
                link1.product = linkProduct;
                string str = string.Format("http://vk.com/product{0}_{1}", (object)product.owner_id, (object)product.id);
                link1.url = str;
                Link           link  = link1;
                NewsLinkUCBase tmpUC = (NewsLinkUCBase) new NewsLinkMediumUC();
                tmpUC.Initialize(link, this.Width);
                this._marketItem = new UCItem(this.Width - 16.0, new Thickness(), (Func <UserControlVirtualizable>)(() =>
                {
                    NewsLinkMediumUC newsLinkMediumUc = new NewsLinkMediumUC();
                    //Link link = link;
                    double width = this.Width;
                    newsLinkMediumUc.Initialize(link, width);
                    return((UserControlVirtualizable)newsLinkMediumUc);
                }), (Func <double>)(() => tmpUC.CalculateTotalHeight()), (Action <UserControlVirtualizable>)null, 0.0, false);
                this.VirtualizableChildren.Add((IVirtualizable)this._marketItem);
            }
            this._marketItem.ViewMargin = new Thickness(8.0, top, 8.0, 0.0);
            return(top + this._marketItem.FixedHeight + 16.0);
        }
Exemplo n.º 2
0
        private UCItem CreateSnippetItem(Link link, double topMargin)
        {
            double         num1          = this._isCommentAttachments ? 0.0 : 8.0;
            double         portraitWidth = this._verticalWidth - num1 * 2.0;
            double         num2          = (double)ScaleFactor.GetRealScaleFactor() / 100.0;
            double         num3          = portraitWidth / 2.0 * num2;
            bool           isBigSnippet  = (double)link.photo.width >= num3;
            NewsLinkUCBase tmpUC         = !isBigSnippet ? (NewsLinkUCBase) new NewsLinkMediumUC() : (NewsLinkUCBase) new NewsLinkUC();

            tmpUC.Initialize(link, portraitWidth);
            return(new UCItem(portraitWidth, new Thickness(num1, topMargin, num1, 0.0), (Func <UserControlVirtualizable>)(() =>
            {
                NewsLinkUCBase newsLinkUcBase = !isBigSnippet ? (NewsLinkUCBase) new NewsLinkMediumUC() : (NewsLinkUCBase) new NewsLinkUC();
                newsLinkUcBase.Initialize(link, portraitWidth);
                return (UserControlVirtualizable)newsLinkUcBase;
            }), (Func <double>)(() => tmpUC.CalculateTotalHeight()), (Action <UserControlVirtualizable>)null, 0.0, false));
        }
Exemplo n.º 3
0
        private UCItem CreateSnippetItem(Link link, double topMargin)
        {
            double         num1           = this._isCommentAttachments || this._isMessage ? 0.0 : 8.0;
            double         portraitWidth  = this._verticalWidth - num1 * 2.0;
            double         landscapeWidth = this._horizontalWidth - num1 * 2.0;
            double         num2           = (double)ScaleFactor.GetRealScaleFactor() / 100.0;
            double         num3           = portraitWidth / 2.0 * num2;
            Photo          photo          = link.photo;
            int?           nullable1      = photo != null ? new int?(photo.width) : new int?();
            double?        nullable2      = nullable1.HasValue ? new double?(nullable1.GetValueOrDefault()) : new double?();
            double         num4           = num3;
            bool           isBigSnippet   = (nullable2.GetValueOrDefault() >= num4 ? (nullable2.HasValue ? 1 : 0) : 0) != 0;
            NewsLinkUCBase tmpUC          = !isBigSnippet ? (!this._isMessage ? (NewsLinkUCBase) new NewsLinkMediumUC() : (NewsLinkUCBase) new MessagesLinkMediumUC(this._isForwardedMessage)) : (!this._isMessage ? (NewsLinkUCBase) new NewsLinkUC() : (NewsLinkUCBase) new MessagesLinkUC());
            double         width          = portraitWidth;

            if (this._isMessage)
            {
                topMargin += 4.0;
                if (this._isHorizontal)
                {
                    width = landscapeWidth;
                }
            }
            tmpUC.Initialize(link, width, this._isMessage ? "" : this._parentPostId);
            return(new UCItem(portraitWidth, new Thickness(num1, topMargin, num1, 0.0), (Func <UserControlVirtualizable>)(() =>
            {
                NewsLinkUCBase newsLinkUcBase = !isBigSnippet ? (!this._isMessage ? (NewsLinkUCBase) new NewsLinkMediumUC() : (NewsLinkUCBase) new MessagesLinkMediumUC(this._isForwardedMessage)) : (!this._isMessage ? (NewsLinkUCBase) new NewsLinkUC() : (NewsLinkUCBase) new MessagesLinkUC());
                width = portraitWidth;
                if (this._isMessage && this._isHorizontal)
                {
                    width = landscapeWidth;
                }
                newsLinkUcBase.Initialize(link, width, this._isMessage ? "" : this._parentPostId);
                return (UserControlVirtualizable)newsLinkUcBase;
            }), (Func <double>)(() => tmpUC.CalculateTotalHeight()), null, this._isMessage ? landscapeWidth : 0.0, this._isMessage && this._isHorizontal));
        }