private void CreateMenu() { this._menuItems = new List <MenuItem>(); if (this._hideSourceItemsCallback != null && this.SourceId != AppGlobalStateManager.Current.LoggedInUserId) { MenuItem menuItem1 = new MenuItem(); string hideFromNews = CommonResources.HideFromNews; menuItem1.Header = (object)hideFromNews; MenuItem menuItem2 = menuItem1; menuItem2.Click += new RoutedEventHandler(this.hideFromNewsMenuItem_Click); this._menuItems.Add(menuItem2); } if (this._ignoreNewsfeedItemCallback != null && this.GetIgnoreItemData() != null) { MenuItem menuItem1 = new MenuItem(); string lowerInvariant = CommonResources.HideThisPost.ToLowerInvariant(); menuItem1.Header = (object)lowerInvariant; MenuItem menuItem2 = menuItem1; menuItem2.Click += new RoutedEventHandler(this.HidePostItem_OnClick); this._menuItems.Add(menuItem2); } if (this._getExtraMenuItemsFunc != null) { this._menuItems.AddRange((IEnumerable <MenuItem>) this._getExtraMenuItemsFunc()); } UserOrGroupHeaderItem orGroupHeaderItem = this._headerItem; if (orGroupHeaderItem == null) { return; } List <MenuItem> menuItems = this._menuItems; orGroupHeaderItem.SetMenu(menuItems); }
private void CreateFirstLinePanel() { double num = 0.0; Border postTypeIcon = this.GetPostTypeIcon(); if (postTypeIcon != null) { num += UserOrGroupHeaderItem.GetElementTotalWidth((FrameworkElement)postTypeIcon); } TextBlock textName = new TextBlock() { Text = this._isGroupPost ? this._group.name : this._user.Name, FontSize = 25.3, Foreground = (Brush)(Application.Current.Resources["PhoneDarkBlueBrush"] as SolidColorBrush) }; double maxWidth = this.Width - (92.0 + (this._moreOptionsTapCallback != null ? 68.0 : 16.0) + num); textName.CorrectText(maxWidth); Canvas.SetLeft((UIElement)textName, 92.0); Canvas.SetTop((UIElement)textName, 17.0); this.Children.Add((FrameworkElement)textName); if (postTypeIcon == null) { return; } Canvas.SetLeft((UIElement)postTypeIcon, 92.0 + textName.ActualWidth); Canvas.SetTop((UIElement)postTypeIcon, 17.0); this.Children.Add((FrameworkElement)postTypeIcon); }
private void CreateSecondLinePanel() { double num = 0.0; Border postSourceTypeIcon = this.GetPostSourceTypeIcon(); if (postSourceTypeIcon != null) { num += UserOrGroupHeaderItem.GetElementTotalWidth((FrameworkElement)postSourceTypeIcon); } string subtitleText = this.GetSubtitleText(); TextBlock textBlock = new TextBlock(); textBlock.Text = subtitleText; textBlock.FontSize = 20.0; textBlock.LineStackingStrategy = LineStackingStrategy.BlockLineHeight; textBlock.LineHeight = 26.0; SolidColorBrush solidColorBrush = Application.Current.Resources["PhoneCaptionGrayBrush"] as SolidColorBrush; textBlock.Foreground = (Brush)solidColorBrush; TextBlock textName = textBlock; double maxWidth = this.Width - (92.0 + (this._moreOptionsTapCallback != null ? 68.0 : 16.0) + num); textName.CorrectText(maxWidth); Canvas.SetLeft((UIElement)textName, 92.0); Canvas.SetTop((UIElement)textName, 48.0); this.Children.Add((FrameworkElement)textName); if (postSourceTypeIcon == null) { return; } Canvas.SetLeft((UIElement)postSourceTypeIcon, 92.0 + textName.ActualWidth); Canvas.SetTop((UIElement)postSourceTypeIcon, 48.0); this.Children.Add((FrameworkElement)postSourceTypeIcon); }
private void CreateOptionsIcon() { this._optionsIcon = UserOrGroupHeaderItem.GetOptionsIcon(); this._optionsIcon.Tap += new EventHandler <GestureEventArgs>(this.OptionsIcon_OnTap); Canvas.SetLeft((UIElement)this._optionsIcon, this.Width - this._optionsIcon.Width - 4.0); Canvas.SetTop((UIElement)this._optionsIcon, 4.0); this.Children.Add((FrameworkElement)this._optionsIcon); }
public void OnMoreOptionsTap() { UserOrGroupHeaderItem orGroupHeaderItem = this._headerItem; ContextMenu contextMenu = ContextMenuService.GetContextMenu(orGroupHeaderItem != null ? (DependencyObject)(orGroupHeaderItem.View) : null); if (contextMenu == null) { return; } contextMenu.IsOpen = true; }
public void OnMoreOptionsTap() { UserOrGroupHeaderItem headerItem = this._headerItem; // ISSUE: explicit non-virtual call ContextMenu contextMenu = ContextMenuService.GetContextMenu(headerItem != null ? headerItem.View : null); if (contextMenu == null) { return; } contextMenu.IsOpen = true; }
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; } }