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)); }
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(); }
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; } }
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)); }