예제 #1
0
        private void CreateVirtualizableChildren()
        {
            double top = this._isNotificationComment ? 0.0 : 16.0;

            this._textBlockName = new TextItem(this.Width, new Thickness(74.0, top - 6.0, 0.0, 0.0), this.Name, false, 25.333, "Segoe WP", 0.0, Application.Current.Resources["PhoneNameBlueBrush"] as SolidColorBrush, true, new Action(this.NavigateToSource));
            this.VirtualizableChildren.Add((IVirtualizable)this._textBlockName);
            double    width = this.Width - 74.0;
            Thickness thickness;

            if (!string.IsNullOrEmpty(this._comment.text))
            {
                NewsTextItem newsTextItem = new NewsTextItem(width, new Thickness(74.0, 28.0 + top, 0.0, 0.0), this._comment.text ?? "", this._preview, null, 0.0, (FontFamily)null, 28.0, (Brush)null, false, 0.0, HorizontalAlignment.Left, "", TextAlignment.Left, false);
                this.VirtualizableChildren.Add((IVirtualizable)newsTextItem);
                thickness           = newsTextItem.Margin;
                this._topMarginDate = thickness.Top + newsTextItem.FixedHeight + 4.0;
            }
            else
            {
                this._topMarginDate = 28.0 + top;
            }
            if (!this._comment.Attachments.IsNullOrEmpty())
            {
                string          itemId          = this._comment.from_id == 0L || this._comment.id <= 0L ? "" : string.Format("{0}_{1}", (object)this._comment.from_id, (object)this._comment.id);
                AttachmentsItem attachmentsItem = new AttachmentsItem(width, new Thickness(73.0, this._topMarginDate, 0.0, 0.0), this._comment.Attachments, (Geo)null, itemId, false, true, false, false, 0.0, false, false, "");
                this.VirtualizableChildren.Add((IVirtualizable)attachmentsItem);
                this._topMarginDate = this._topMarginDate + (attachmentsItem.FixedHeight + 12.0);
            }
            this._textTimeItem = new TextItem(width - 70.0, new Thickness(73.0, this._topMarginDate, 0.0, 0.0), this.DateText, true, 20.0, "Segoe WP", VKConstants.LineHeight, Application.Current.Resources["PhoneVKSubtleBrush"] as SolidColorBrush, true, null);
            this.VirtualizableChildren.Add((IVirtualizable)this._textTimeItem);
            thickness    = this._textTimeItem.TextMargin;
            this._height = thickness.Top + this._textTimeItem.FixedHeight;
            if (!string.IsNullOrEmpty(this._highlightedText))
            {
                TextItem textItem = new TextItem(this.Width - 72.0, new Thickness(72.0, this._height, 0.0, 0.0), this._highlightedText, false, 20.0, "Segoe WP", 23.0, Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush, true, null);
                this.VirtualizableChildren.Add((IVirtualizable)textItem);
                this._height = this._height + textItem.FixedHeight;
            }
            if (!string.IsNullOrEmpty(this._thumbSrc))
            {
                this.VirtualizableChildren.Add((IVirtualizable) new VirtualizableImage(80.0, 80.0, new Thickness(77.0, this._height + 6.0, 0.0, 0.0), this._thumbSrc, new Action <VirtualizableImage>(this.OnThumbTap), "", true, true, Stretch.UniformToFill, (Brush)null, -1.0, false, false));
                this._height = this._height + 86.0;
            }
            this.VirtualizableChildren.Add((IVirtualizable) new VirtualizableImage(62.0, 62.0, new Thickness(0.0, top, 0.0, 0.0), this.ImageSrc, new Action <VirtualizableImage>(this.AvaTap), "", true, true, Stretch.UniformToFill, (Brush)null, -1.0, false, true));
            if (this._isNotificationComment || this._preview)
            {
                return;
            }
            this.VirtualizableChildren.Add((IVirtualizable) new UCItem(40.0, new Thickness(this.Width - 32.0, 5.0, 0.0, 0.0), (Func <UserControlVirtualizable>)(() => (UserControlVirtualizable) new MoreActionsUC()
            {
                TapCallback = new Action(this._onMoreOptionsTap)
            }), (Func <double>)(() => 40.0), (Action <UserControlVirtualizable>)null, 0.0, false));
        }
예제 #2
0
        private void CreateOrUpdateLayout()
        {
            double num;

            if (this.IsUnreadItem)
            {
                if (this._unreadItem == null)
                {
                    this._unreadItem = new UnreadItem(this._verticalWidth, new Thickness(), this._isHorizontal, this._horizontalWidth);
                    this.VirtualizableChildren.Add((IVirtualizable)this._unreadItem);
                }
                else
                {
                    this._unreadItem.IsHorizontal = this._isHorizontal;
                }
                num = this._unreadItem.FixedHeight;
            }
            else
            {
                if (this._newsTextItem == null)
                {
                    this._newsTextItem = new NewsTextItem(this._verticalWidth, new Thickness(), this.GetText(), false, null, 0.0, null, 0.0, (Brush)(Application.Current.Resources["PhoneVKSubtleBrush"] as SolidColorBrush), this._isHorizontal, this._horizontalWidth, (HorizontalAlignment)1, "", (TextAlignment)0, true, null, false, false);
                    this.VirtualizableChildren.Add((IVirtualizable)this._newsTextItem);
                }
                else
                {
                    this._newsTextItem.IsHorizontalOrientation = this._isHorizontal;
                }
                num = this._newsTextItem.FixedHeight + 12.0;
                if (this._mvm.Message.attachments != null && this._mvm.Message.attachments.Count > 0)
                {
                    if (this._attachmentsItem == null)
                    {
                        this._attachmentsItem = new AttachmentsItem(this.ATTACHMENT_WIDTH, new Thickness((this.Width - this.ATTACHMENT_WIDTH) / 2.0, num, 0.0, 0.0), this._mvm.Message.attachments, null, "", false, false, true, this._isHorizontal, this.ATTACHMENT_WIDTH, false, false, "", null, null, false);
                        this.VirtualizableChildren.Add((IVirtualizable)this._attachmentsItem);
                    }
                    else
                    {
                        this._attachmentsItem.IsHorizontal = this._isHorizontal;
                        this._attachmentsItem.Margin       = new Thickness((this.Width - this.ATTACHMENT_WIDTH) / 2.0, num, 0.0, 0.0);
                    }
                    num += this._attachmentsItem.FixedHeight;
                }
            }
            this._fixedHeight = num;
        }
예제 #3
0
        private void GenerateLayoutForWallPost()
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            Thickness margin = new Thickness();
            Action    action = null;

            if (this._preview)
            {
                action = new Action(this.OnMoreOptionsTap);
            }
            if (this._originalHeaderItem == null)
            {
                this._originalHeaderItem = new UserOrGroupHeaderItem(this.Width, new Thickness(), this.IsGroupPost, this._wallPost.date, this._fromUser, this._fromGroup, this.ExtraText, this.IconType, this.PostSourcePlatform, this._isFeedbackItem ? null : action, new Action(this.onNavigatedToUserOrGroup), this.ExtraTextEnd);
                this.VirtualizableChildren.Add((IVirtualizable)this._originalHeaderItem);
            }
            this._originalHeaderItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
            margin.Top += this._originalHeaderItem.FixedHeight + 8.0;
            if (!string.IsNullOrEmpty(this._wallPost.text))
            {
                if (this._originalTextItem == null)
                {
                    this._originalTextItem = new NewsTextItem(this.Width - 32.0, new Thickness(16.0, 0.0, 16.0, 0.0), this._wallPost.text, this._preview, (Action)(() => this.NavigateToWallPostWithComments(false)), 21.3, new FontFamily("Segoe WP"), 28.0, (Brush)null, false, 0.0, HorizontalAlignment.Left, this._wallPost.PostId, TextAlignment.Left, true);
                    this.VirtualizableChildren.Add((IVirtualizable)this._originalTextItem);
                }
                this._originalTextItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
                margin.Top += this._originalTextItem.FixedHeight + 8.0;
            }
            this.CanShowLikesSeparator = true;
            if ((!this._wallPost.attachments.IsNullOrEmpty() ? 1 : (this._wallPost.geo != null ? 1 : 0)) != 0)
            {
                if (this._originalAttachmentsItem == null)
                {
                    this._originalAttachmentsItem = new AttachmentsItem(this.Width, new Thickness(), this._wallPost.attachments, this._wallPost.geo, this._wallPost.from_id == 0L || this._wallPost.id <= 0L ? "" : string.Format("{0}_{1}", (object)this._wallPost.from_id, (object)this._wallPost.id), this._wallPost.friends_only == 1, false, false, false, 0.0, false, !this._preview, this._wallPost.PostId);
                    this.VirtualizableChildren.Add((IVirtualizable)this._originalAttachmentsItem);
                }
                this._originalAttachmentsItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
                margin.Top += this._originalAttachmentsItem.FixedHeight;
                this.CanShowLikesSeparator = !this._originalAttachmentsItem.IsLastAttachmentMedia;
            }
            if (this._wallPost.signer_id != 0L)
            {
                margin.Top += 8.0;
                if (this._originalSignerItem == null)
                {
                    this._originalSignerItem = new LinkToUserOrGroupItem(this.Width, new Thickness(), new long?(this._wallPost.signer_id), this._users, this._groups, null);
                    this.VirtualizableChildren.Add((IVirtualizable)this._originalSignerItem);
                }
                this._originalSignerItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
                margin.Top += this._originalSignerItem.FixedHeight;
                this.CanShowLikesSeparator = true;
            }
            if (!this._wallPost.copy_history.IsNullOrEmpty())
            {
                int index = 0;
                foreach (WallPost wallPost in this._wallPost.copy_history)
                {
                    int currentInd = index;
                    WallPostItem.WallPostHistoryVirtItems historyVirtItems = this._historyVirtItemsDict.ContainsKey(currentInd) ? this._historyVirtItemsDict[currentInd] : new WallPostItem.WallPostHistoryVirtItems();
                    bool   isMale;
                    string pic;
                    string name;
                    this.GetNamePicAndSex(wallPost.from_id, out name, out pic, out isMale);
                    int                num1               = WallPostItem.GetIsProfilePhoto(wallPost.attachments, wallPost.post_source) ? 1 : 0;
                    bool               flag               = wallPost.owner_id < 0L;
                    int                num2               = wallPost.IsRepost() ? 1 : 0;
                    int                num3               = isMale ? 1 : 0;
                    int                num4               = flag ? 1 : 0;
                    string             extraText          = WallPostItem.GetExtraText(num1 != 0, num2 != 0, num3 != 0, num4 != 0);
                    string             extraTextEnd       = WallPostItem.GetExtraTextEnd(wallPost.IsReply);
                    PostSource         postSource         = wallPost.post_source;
                    PostSourcePlatform postSourcePlatform = (PostSourcePlatform)(postSource != null ? (int)postSource.GetPlatform() : 0);
                    string             subtitle           = "";
                    if (!string.IsNullOrEmpty(extraText))
                    {
                        subtitle = extraText.ToLowerInvariant();
                    }
                    else if (wallPost.date != 0)
                    {
                        subtitle = UIStringFormatterHelper.FormatDateTimeForUI(VKClient.Common.Utils.Extensions.UnixTimeStampToDateTime((double)wallPost.date, true));
                    }
                    if (!string.IsNullOrEmpty(extraTextEnd))
                    {
                        subtitle += string.Format(" {0}", (object)extraTextEnd);
                    }
                    margin.Top += 8.0;
                    if (historyVirtItems.HeaderItem == null)
                    {
                        historyVirtItems.HeaderItem = new UCItem(this.Width, new Thickness(), (Func <UserControlVirtualizable>)(() =>
                        {
                            RepostHeaderUC repostHeaderUc = new RepostHeaderUC();
                            this._wallRepostInfo          = new WallRepostInfo()
                            {
                                Pic                = pic,
                                Name               = name,
                                Subtitle           = subtitle,
                                PostSourcePlatform = postSourcePlatform,
                                Width              = this.Width - 16.0
                            };
                            WallRepostInfo configuration = this._wallRepostInfo;
                            repostHeaderUc.Configure(configuration, (Action)(() => this.LinkToUserOrGroupTap(currentInd)));
                            return((UserControlVirtualizable)repostHeaderUc);
                        }), (Func <double>)(() => 56.0), (Action <UserControlVirtualizable>)null, 0.0, false);
                        this.VirtualizableChildren.Add((IVirtualizable)historyVirtItems.HeaderItem);
                    }
                    historyVirtItems.HeaderItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
                    margin.Top += historyVirtItems.HeaderItem.FixedHeight + 8.0;
                    if (!string.IsNullOrWhiteSpace(wallPost.text))
                    {
                        if (historyVirtItems.TextItem == null)
                        {
                            historyVirtItems.TextItem = new NewsTextItem(this.Width - 32.0, new Thickness(16.0, 0.0, 16.0, 0.0), wallPost.text, this._preview, (Action)(() => this.NavigateToWallPostWithComments(false)), 21.3, new FontFamily("Segoe WP"), 28.0, (Brush)null, false, 0.0, HorizontalAlignment.Left, wallPost.PostId, TextAlignment.Left, true);
                            this.VirtualizableChildren.Add((IVirtualizable)historyVirtItems.TextItem);
                        }
                        historyVirtItems.TextItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
                        margin.Top += historyVirtItems.TextItem.FixedHeight + 8.0;
                    }
                    if ((!wallPost.attachments.IsNullOrEmpty() ? 1 : (wallPost.geo != null ? 1 : 0)) != 0)
                    {
                        if (historyVirtItems.AttachmentsItem == null)
                        {
                            string itemId = wallPost.from_id == 0L || wallPost.id <= 0L ? "" : string.Format("{0}_{1}", (object)wallPost.from_id, (object)wallPost.id);
                            historyVirtItems.AttachmentsItem = new AttachmentsItem(this.Width, new Thickness(), wallPost.attachments, wallPost.geo, itemId, wallPost.friends_only == 1, false, false, false, 0.0, false, !this._preview, wallPost.PostId);
                            this.VirtualizableChildren.Add((IVirtualizable)historyVirtItems.AttachmentsItem);
                        }
                        historyVirtItems.AttachmentsItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
                        margin.Top += historyVirtItems.AttachmentsItem.FixedHeight;
                        this.CanShowLikesSeparator = !historyVirtItems.AttachmentsItem.IsLastAttachmentMedia;
                    }
                    if (wallPost.signer_id != 0L)
                    {
                        margin.Top += 8.0;
                        if (historyVirtItems.SignerItem == null)
                        {
                            historyVirtItems.SignerItem = new LinkToUserOrGroupItem(this.Width, new Thickness(), new long?(wallPost.signer_id), this._users, this._groups, null);
                            this.VirtualizableChildren.Add((IVirtualizable)historyVirtItems.SignerItem);
                        }
                        historyVirtItems.SignerItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
                        margin.Top += historyVirtItems.SignerItem.FixedHeight;
                        this.CanShowLikesSeparator = true;
                    }
                    this._historyVirtItemsDict[index] = historyVirtItems;
                    ++index;
                }
            }
            if (this._preview)
            {
                bool isReply = this._wallPost.IsReply;
                if (!this.IsSuggestedPostponed && !this._isFeedbackItem && !isReply)
                {
                    if (this.CanShowLikesSeparator)
                    {
                        margin.Top += 8.0;
                    }
                    margin.Top = Math.Round(margin.Top);
                    if (this.LikesAndCommentsItem == null)
                    {
                        this.LikesAndCommentsItem = new LikesAndCommentsItem(this.Width, new Thickness(), this._wallPost, (Action)(() => this.NavigateToWallPostWithComments(true)), this._suppressRepostButton, this.CanShowLikesSeparator);
                        this.VirtualizableChildren.Add((IVirtualizable)this.LikesAndCommentsItem);
                    }
                    this.LikesAndCommentsItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
                    margin.Top += this.LikesAndCommentsItem.FixedHeight;
                }
                else if (isReply)
                {
                    margin.Top += 8.0;
                }
            }
            else
            {
                margin.Top += 8.0;
            }
            if (this._preview && this.IsSuggested && this._wallPost.can_publish == 1)
            {
                margin.Top += 8.0;
                if (this._publishRejectItem == null)
                {
                    this._publishRejectItem = new UCItem(this.Width, margin, (Func <UserControlVirtualizable>)(() =>
                    {
                        PublicRejectUC publicRejectUc     = new PublicRejectUC();
                        publicRejectUc.buttonPublish.Tap += new EventHandler <System.Windows.Input.GestureEventArgs>(this.buttonPublish_Tap);
                        publicRejectUc.buttonDelete.Tap  += new EventHandler <System.Windows.Input.GestureEventArgs>(this.buttonDelete_Tap);
                        return((UserControlVirtualizable)publicRejectUc);
                    }), (Func <double>)(() => 60.0), (Action <UserControlVirtualizable>)null, 0.0, false);
                    this.VirtualizableChildren.Add((IVirtualizable)this._publishRejectItem);
                }
                margin.Top += this._publishRejectItem.FixedHeight;
            }
            this._height = margin.Top;
            if (this._preview && this._showDivideLine)
            {
                this._height = this._height + this.DividerHeight;
            }
            stopwatch.Stop();
        }
예제 #4
0
        private void CreateVirtualizableChildren()
        {
            double num = this._isNotificationComment ? 0.0 : 16.0;

            // ISSUE: method pointer
            this._textBlockName = new TextItem(this.Width, new Thickness(74.0, num - 6.0, 0.0, 0.0), this.Name, false, 25.333, "Segoe WP", 0.0, Application.Current.Resources["PhoneNameBlueBrush"] as SolidColorBrush, true, new Action(this.NavigateToSource));
            base.VirtualizableChildren.Add((IVirtualizable)this._textBlockName);
            this._textWidth = this.Width - 74.0;
            if (!string.IsNullOrEmpty(this._comment.text))
            {
                NewsTextItem newsTextItem = new NewsTextItem(this._textWidth, new Thickness(74.0, 28.0 + num, 0.0, 0.0), this._comment.text ?? "", this._preview, null, 0.0, null, 28.0, null, false, 0.0, (HorizontalAlignment)0, "", (TextAlignment)1, false, null, false, false);
                base.VirtualizableChildren.Add((IVirtualizable)newsTextItem);
                Thickness margin = newsTextItem.Margin;
                // ISSUE: explicit reference operation
                this._topMarginDate = ((Thickness)@margin).Top + newsTextItem.FixedHeight + 4.0;
            }
            else
            {
                this._topMarginDate = 28.0 + num;
            }
            if (!((IList)this._comment.Attachments).IsNullOrEmpty())
            {
                string          itemId          = (this._comment.from_id != 0L && this._comment.id > 0L) ? string.Format("{0}_{1}", this._comment.from_id, this._comment.id) : "";
                AttachmentsItem attachmentsItem = new AttachmentsItem(this._textWidth, new Thickness(73.0, this._topMarginDate, 0.0, 0.0), this._comment.Attachments, null, itemId, false, true, false, false, 0.0, false, false, "", null, null, false);
                base.VirtualizableChildren.Add(attachmentsItem);
                this._topMarginDate += attachmentsItem.FixedHeight + 12.0;
            }
            if (!this._isNotificationComment && !this._preview)
            {
                double    arg_2F6_0 = 40.0;
                Thickness arg_2F6_1 = new Thickness(base.Width - 32.0, 5.0, 0.0, 0.0);
                Func <UserControlVirtualizable> arg_2F6_2 = delegate
                {
                    Rectangle expr_05 = new Rectangle();
                    expr_05.Fill = ((SolidColorBrush)Application.Current.Resources["PhoneNewsBackgroundBrush"]);
                    expr_05.HorizontalAlignment = HorizontalAlignment.Right;
                    expr_05.VerticalAlignment   = (0);
                    expr_05.Margin = (new Thickness(-8.0, -4.0, -8.0, -4.0));
                    expr_05.Height = (48.0);
                    expr_05.Width  = (56.0);
                    Rectangle rectangle = expr_05;
                    VKClient.Common.UC.MoreActionsUC expr_85 = new VKClient.Common.UC.MoreActionsUC();
                    expr_85.LayoutRoot.Children.Insert(0, rectangle);
                    expr_85.TapCallback = new Action(this._onMoreOptionsTap);
                    return(expr_85);
                };
                Func <double> arg_2F6_3 = new Func <double>(() => { return(40.0); });

                UCItem uCItem = new UCItem(arg_2F6_0, arg_2F6_1, arg_2F6_2, arg_2F6_3, null, 0.0, false);
                base.VirtualizableChildren.Add(uCItem);
            }
            this._textTimeItem = new TextItem(this._textWidth - 136.0, new Thickness(73.0, this._topMarginDate, 0.0, 0.0), this.DateText, true, 20.0, "Segoe WP", VKConstants.LineHeight, Application.Current.Resources["PhoneVKSubtleBrush"] as SolidColorBrush, true, null);
            base.VirtualizableChildren.Add((IVirtualizable)this._textTimeItem);
            Thickness textMargin = this._textTimeItem.TextMargin;

            // ISSUE: explicit reference operation
            this._height = ((Thickness)@textMargin).Top + this._textTimeItem.FixedHeight;
            if (!string.IsNullOrEmpty(this._highlightedText))
            {
                TextItem textItem = new TextItem(this.Width - 72.0, new Thickness(72.0, this._height, 0.0, 0.0), this._highlightedText, false, 20.0, "Segoe WP", 23.0, Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush, true, null);
                base.VirtualizableChildren.Add((IVirtualizable)textItem);
                this._height = this._height + textItem.FixedHeight;
            }
            if (!string.IsNullOrEmpty(this._thumbSrc))
            {
                base.VirtualizableChildren.Add((IVirtualizable) new VirtualizableImage(80.0, 80.0, new Thickness(77.0, this._height + 6.0, 0.0, 0.0), this._thumbSrc, new Action <VirtualizableImage>(this.OnThumbTap), "", true, true, (Stretch)3, null, -1.0, false, false));
                this._height = this._height + 86.0;
            }
            base.VirtualizableChildren.Add((IVirtualizable) new VirtualizableImage(62.0, 62.0, new Thickness(0.0, num, 0.0, 0.0), this.ImageSrc, new Action <VirtualizableImage>(this.AvaTap), "", true, true, (Stretch)3, null, -1.0, false, true));
        }
예제 #5
0
        private void GenerateLayout()
        {
            double num1 = this._marginTop;

            if (this._mvm.IsForwarded)//Идёт добавление шапки
            {
                if (this._forwardedHeaderItem == null)
                {
                    this._forwardedHeaderItem = new ForwardedHeaderItem(this._verticalWidth - this._marginLeft * 2.0 - this.ForwardedMarginLeft, new Thickness(this._marginLeft + this.ForwardedMarginLeft, num1, 0.0, 0.0), this._mvm);
                    base.VirtualizableChildren.Add(this._forwardedHeaderItem);
                }
                num1 = num1 + this._forwardedHeaderItem.FixedHeight + (double)MessageContentItem.MARGIN_BETWEEN;
            }
            string body              = this._mvm.Message.body;
            bool   flag1             = !string.IsNullOrWhiteSpace(body);
            bool   flag2             = this._mvm.Attachments != null && Enumerable.Any <AttachmentViewModel>(this._mvm.Attachments, (Func <AttachmentViewModel, bool>)(a => a.AttachmentType == AttachmentType.Gift));
            bool   isStickersGift    = false;
            long   stickersProductId = 0;
            bool   isForwarded       = this._mvm.IsForwarded;
            bool   flag3             = this._mvm.Message.@out == 0;

            if (flag2)
            {
                AttachmentViewModel m0 = Enumerable.FirstOrDefault <AttachmentViewModel>(this._mvm.Attachments, (Func <AttachmentViewModel, bool>)(a => a.AttachmentType == AttachmentType.Gift));
                Gift gift = m0 != null ? m0.Gift : null;
                if (gift != null)
                {
                    stickersProductId = gift.stickers_product_id;
                    isStickersGift    = (ulong)stickersProductId > 0UL;
                }
            }
            if (flag1 && !flag2)
            {
                if (this._textItem == null)
                {
                    this._textItem = new NewsTextItem(this._verticalWidth - this._marginLeft * 2.0 - this.ForwardedMarginLeft, new Thickness(this._marginLeft + this.ForwardedMarginLeft, num1, 0.0, 0.0), body, false, null, 25.33, new FontFamily("Segoe WP Semilight"), 32.0, (Brush)(Application.Current.Resources["PhoneForegroundBrush"] as SolidColorBrush), this._isHorizontalOrientation, this._horizontalWidth - this._marginLeft * 2.0 - this.ForwardedMarginLeft, (HorizontalAlignment)0, "", (TextAlignment)1, true, null, false, false);
                    base.VirtualizableChildren.Add((IVirtualizable)this._textItem);
                }
                this._textItem.IsHorizontalOrientation = this.IsHorizontalOrientation;
                this._textItem.Margin = new Thickness(this._marginLeft + this.ForwardedMarginLeft, num1, 0.0, 0.0);
                num1 += this._textItem.FixedHeight;
            }
            if (this._mvm.Attachments != null && ((Collection <AttachmentViewModel>) this._mvm.Attachments).Count > 0)
            {
                if (this._textItem != null)
                {
                    num1 += (double)MessageContentItem.MARGIN_BETWEEN;
                }
                Geo geo1 = (Geo)Enumerable.FirstOrDefault <Geo>(Enumerable.Select <AttachmentViewModel, Geo>(Enumerable.Where <AttachmentViewModel>(this._mvm.Attachments, (Func <AttachmentViewModel, bool>)(a => a.Geo != null)), (Func <AttachmentViewModel, Geo>)(a => a.Geo)));
                List <Attachment> list = Enumerable.ToList <Attachment>(Enumerable.Select <AttachmentViewModel, Attachment>(Enumerable.Where <AttachmentViewModel>(this._mvm.Attachments, (Func <AttachmentViewModel, bool>)(a => a.Attachment != null)), (Func <AttachmentViewModel, Attachment>)(a => a.Attachment)));
                if (this._attachmentsItem == null)
                {
                    double num2 = this._verticalWidth - this._marginLeft * 2.0 - this.ForwardedMarginLeft;
                    double num3 = this._horizontalWidth - this._marginLeft * 2.0 - this.ForwardedMarginLeft;
                    if (num2 > MessageContentItem.MIN_WIDTH)
                    {
                        string            str         = this._mvm.Message.from_id != 0L ? this._mvm.Message.from_id.ToString() : "";
                        double            width       = num2;
                        Thickness         margin      = new Thickness(this._marginLeft + this.ForwardedMarginLeft, num1, 0.0, 0.0);
                        List <Attachment> attachments = list;
                        Geo    geo2            = geo1;
                        string itemId          = str;
                        int    num4            = 0;
                        int    num5            = 0;
                        int    num6            = 1;
                        int    num7            = this._isHorizontalOrientation ? 1 : 0;
                        double horizontalWidth = num3;
                        int    num8            = this._mvm.Message.@out == 1 ? 1 : 0;
                        int    num9            = 0;
                        string hyperlinkId     = "";
                        // ISSUE: variable of the null type

                        User parentDialogUser = this._mvm != null ? this._mvm.AssociatedUser : null;
                        int  num10            = this._mvm != null ? (this._mvm.IsForwarded ? 1 : 0) : 0;
                        this._attachmentsItem = new AttachmentsItem(width, margin, attachments, geo2, itemId, num4 != 0, num5 != 0, num6 != 0, num7 != 0, horizontalWidth, num8 != 0, num9 != 0, hyperlinkId, null, parentDialogUser, num10 != 0);
                        base.VirtualizableChildren.Add((IVirtualizable)this._attachmentsItem);
                    }
                }
                if (this._attachmentsItem != null)
                {
                    this._attachmentsItem.IsHorizontal = this.IsHorizontalOrientation;
                    this._attachmentsItem.Margin       = new Thickness(this._marginLeft + this.ForwardedMarginLeft, num1, 0.0, 0.0);
                    num1 += this._attachmentsItem.FixedHeight;
                }
            }
            if (flag2)
            {
                if (this._giftCaptionItem == null)
                {
                    this._giftCaptionItem = new GiftCaptionItem(this._verticalWidth - this._marginLeft * 2.0 - this.ForwardedMarginLeft, this._horizontalWidth - this._marginLeft - this.ForwardedMarginLeft, this.IsHorizontalOrientation, new Thickness(this._marginLeft + this.ForwardedMarginLeft, num1, 0.0, 0.0), isStickersGift, isForwarded);
                    base.VirtualizableChildren.Add((IVirtualizable)this._giftCaptionItem);
                }
                this._giftCaptionItem.IsLandscape = this.IsHorizontalOrientation;
                this._giftCaptionItem.Margin      = new Thickness(this._marginLeft + this.ForwardedMarginLeft, num1, 0.0, 0.0);
                num1 += this._giftCaptionItem.FixedHeight;
                if (flag1)
                {
                    if (this._textItem == null)
                    {
                        SolidColorBrush solidColorBrush = isForwarded ? Application.Current.Resources["PhoneAlmostBlackBrush"] as SolidColorBrush : Application.Current.Resources["PhoneDialogGiftMessageForegroundBrush"] as SolidColorBrush;
                        this._textItem = new NewsTextItem(this._verticalWidth - this._marginLeft * 2.0 - this.ForwardedMarginLeft, new Thickness(this._marginLeft + this.ForwardedMarginLeft, num1, 0.0, 0.0), body, false, null, 21.3, new FontFamily("Segoe WP"), 28.0, (Brush)solidColorBrush, this._isHorizontalOrientation, this._horizontalWidth - this._marginLeft * 2.0 - this.ForwardedMarginLeft, isForwarded ? (HorizontalAlignment)0 : (HorizontalAlignment)1, "", isForwarded ? (TextAlignment)1 : (TextAlignment)0, true, null, false, false);
                        base.VirtualizableChildren.Add((IVirtualizable)this._textItem);
                    }
                    this._textItem.IsHorizontalOrientation = this.IsHorizontalOrientation;
                    this._textItem.Margin = new Thickness(this._marginLeft + this.ForwardedMarginLeft, num1, 0.0, 0.0);
                    num1 += this._textItem.FixedHeight;
                }
                if (flag3 & isStickersGift && !isForwarded)
                {
                    if (flag1)
                    {
                        num1 += (double)(MessageContentItem.MARGIN_BETWEEN * 2);
                    }
                    if (this._giftStickersButtonItem == null)
                    {
                        this._giftStickersButtonItem = new GiftStickersButtonItem(this._verticalWidth, this._horizontalWidth, this.IsHorizontalOrientation, new Thickness(0.0, num1, 0.0, 0.0), stickersProductId);
                        base.VirtualizableChildren.Add(this._giftStickersButtonItem);
                    }
                    this._giftStickersButtonItem.IsLandscape = this.IsHorizontalOrientation;
                    this._giftStickersButtonItem.Margin      = new Thickness(0.0, num1, 0.0, 0.0);
                    num1 += this._giftStickersButtonItem.FixedHeight;
                }
            }
            if (this._mvm.ForwardedMessages != null && (this._mvm.ForwardedMessages).Count > 0)
            {
                if (this._textItem != null || this._attachmentsItem != null)
                {
                    num1 += (double)MessageContentItem.MARGIN_BETWEEN;
                }
                if (this._forwardedList == null)
                {
                    this._forwardedList = new List <MessageContentItem>();
                    using (IEnumerator <MessageViewModel> enumerator = (this._mvm.ForwardedMessages).GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            MessageViewModel current         = enumerator.Current;
                            double           verticalWidth   = this._verticalWidth - this._marginLeft - this.ForwardedMarginLeft;
                            double           horizontalWidth = this._horizontalWidth - this._marginLeft - this.ForwardedMarginLeft;
                            if (verticalWidth > MessageContentItem.MIN_WIDTH && this._lvl < MessageContentItem.MAX_LEVEL)
                            {
                                MessageContentItem messageContentItem = new MessageContentItem(verticalWidth, new Thickness(this._marginLeft + this.ForwardedMarginLeft, num1, 0.0, 0.0), current, horizontalWidth, this.IsHorizontalOrientation, this._lvl + 1);
                                base.VirtualizableChildren.Add((IVirtualizable)messageContentItem);
                                this._forwardedList.Add(messageContentItem);
                                num1 += messageContentItem.FixedHeight;
                                num1 += (double)MessageContentItem.MARGIN_BETWEEN;
                            }
                        }
                    }
                }
                else
                {
                    foreach (MessageContentItem forwarded in this._forwardedList)
                    {
                        forwarded.IsHorizontalOrientation = this.IsHorizontalOrientation;
                        forwarded.Margin = new Thickness(this._marginLeft + this.ForwardedMarginLeft, num1, 0.0, 0.0);
                        num1            += forwarded.FixedHeight;
                        num1            += (double)MessageContentItem.MARGIN_BETWEEN;
                    }
                }
                if (Enumerable.Any <MessageContentItem>(this._forwardedList))
                {
                    num1 -= (double)MessageContentItem.MARGIN_BETWEEN;
                }
            }
            if (!this._mvm.IsForwarded)
            {
                if (this._messageFooterItem == null)
                {
                    this._messageFooterItem = new MessageFooterItem(this._verticalWidth - this._marginLeft * 2.0, new Thickness(this._marginLeft, num1, 0.0, 0.0), this._mvm, this.IsHorizontalOrientation, this._horizontalWidth - this._marginLeft * 2.0);
                    base.VirtualizableChildren.Add(this._messageFooterItem);
                }
                else
                {
                    this._messageFooterItem.IsHorizontalOrientation = this.IsHorizontalOrientation;
                    this._messageFooterItem.Margin = new Thickness(this._marginLeft, num1, 0.0, 0.0);
                }
                num1 += this._messageFooterItem.FixedHeight + (double)MessageContentItem.MARGIN_BETWEEN;
            }
            if (!this._mvm.IsForwarded)
            {
                num1 += this._marginTop;
            }
            this._height = num1;
        }