private void UpdateViews(Border imageLike, TextBlock textBlockLikesCount, Canvas likesCanvas, Border imageComment, TextBlock textBlockCommentsCount, Canvas commentsCanvas, Border imageRepost, TextBlock textBlockRepostCount, Canvas repostsCanvas) { bool userLikes = this.UserLikes; imageLike.Background = (Brush)LikesAndCommentsItem.GetIconBackground(userLikes); textBlockLikesCount.Foreground = (Brush)LikesAndCommentsItem.GetIconCounterForeground(userLikes); textBlockLikesCount.Text = LikesAndCommentsItem.GetTextForCount(this.LikesCount); double actualWidth1 = textBlockLikesCount.ActualWidth; if (actualWidth1 > 0.0) { likesCanvas.Width = 56.0 + actualWidth1 + 20.0; } else { likesCanvas.Width = 64.0; } Canvas.SetLeft((UIElement)imageLike, 16.0); Canvas.SetLeft((UIElement)textBlockLikesCount, 56.0); Canvas.SetLeft((UIElement)commentsCanvas, likesCanvas.Width); textBlockCommentsCount.Text = LikesAndCommentsItem.GetTextForCount(this.CommentsCount); double actualWidth2 = textBlockCommentsCount.ActualWidth; if (actualWidth2 > 0.0) { commentsCanvas.Width = 56.0 + actualWidth2 + 20.0; } else { commentsCanvas.Width = 64.0; } Canvas.SetLeft((UIElement)imageComment, 16.0); Canvas.SetLeft((UIElement)textBlockCommentsCount, 56.0); Visibility visibility = !this._suppressRepostButton ? Visibility.Visible : Visibility.Collapsed; imageRepost.Visibility = visibility; textBlockRepostCount.Visibility = visibility; bool userReposted = this.UserReposted; imageRepost.Background = (Brush)LikesAndCommentsItem.GetIconBackground(userReposted); textBlockRepostCount.Foreground = (Brush)LikesAndCommentsItem.GetIconCounterForeground(userReposted); textBlockRepostCount.Text = LikesAndCommentsItem.GetTextForCount(this.RepostsCount); double actualWidth3 = textBlockRepostCount.ActualWidth; double num; if (actualWidth3 > 0.0) { num = 56.0 + actualWidth3 + 20.0; Canvas.SetLeft((UIElement)imageRepost, 16.0); } else { num = 64.0; Canvas.SetLeft((UIElement)imageRepost, 16.0); } repostsCanvas.Width = num; Canvas.SetLeft((UIElement)textBlockRepostCount, 56.0); Canvas.SetLeft((UIElement)repostsCanvas, this.Width - num); }
private void UpdateCommentsVisibility(UIElement imageComment, TextBlock textBlockCommentsCount, Canvas commentsCanvas) { if (this.CanPost || this.CommentsCount > 0) { imageComment.Visibility = Visibility.Visible; ((UIElement)textBlockCommentsCount).Visibility = Visibility.Visible; ((UIElement)commentsCanvas).Visibility = Visibility.Visible; } else { imageComment.Visibility = Visibility.Collapsed; ((UIElement)textBlockCommentsCount).Visibility = Visibility.Collapsed; ((UIElement)commentsCanvas).Visibility = Visibility.Collapsed; } textBlockCommentsCount.Text = (LikesAndCommentsItem.GetTextForCount(this.CommentsCount)); }
private void UpdateViews(Border imageLike, TextBlock textBlockLikesCount, Canvas likesCanvas, Border imageComment, TextBlock textBlockCommentsCount, Canvas commentsCanvas, Border imageRepost, TextBlock textBlockRepostCount, Canvas repostsCanvas) { bool userLikes = this.UserLikes; imageLike.Background = ((Brush)LikesAndCommentsItem.GetIconBackground(userLikes)); textBlockLikesCount.Foreground = ((Brush)LikesAndCommentsItem.GetIconCounterForeground(userLikes)); textBlockLikesCount.Text = (LikesAndCommentsItem.GetTextForCount(this.LikesCount)); double num1 = (this.Width - 0.0) / 3.0; double actualWidth1 = ((FrameworkElement)textBlockLikesCount).ActualWidth; if (this._alignCenter) { Canvas.SetLeft((UIElement)likesCanvas, 0.0); ((FrameworkElement)likesCanvas).Width = num1; double num2 = 32.0; if (actualWidth1 > 0.0) { num2 += 16.0 + actualWidth1; } double num3 = num1 / 2.0 - num2 / 2.0; Canvas.SetLeft((UIElement)imageLike, num3); Canvas.SetLeft((UIElement)textBlockLikesCount, num3 + 32.0 + 12.0); } else { if (actualWidth1 > 0.0) { ((FrameworkElement)likesCanvas).Width = (60.0 + actualWidth1 + 20.0); } else { ((FrameworkElement)likesCanvas).Width = 64.0; } Canvas.SetLeft((UIElement)imageLike, 16.0); Canvas.SetLeft((UIElement)textBlockLikesCount, 60.0); } textBlockCommentsCount.Text = (LikesAndCommentsItem.GetTextForCount(this.CommentsCount)); double actualWidth2 = ((FrameworkElement)textBlockCommentsCount).ActualWidth; if (this._alignCenter) { Canvas.SetLeft((UIElement)commentsCanvas, 0.0 + num1); ((FrameworkElement)commentsCanvas).Width = num1; double num2 = 32.0; if (actualWidth2 > 0.0) { num2 += 16.0 + actualWidth2; } double num3 = num1 / 2.0 - num2 / 2.0; Canvas.SetLeft((UIElement)imageComment, num3); Canvas.SetLeft((UIElement)textBlockCommentsCount, num3 + 32.0 + 12.0); } else { Canvas.SetLeft((UIElement)commentsCanvas, ((FrameworkElement)likesCanvas).Width); if (actualWidth2 > 0.0) { ((FrameworkElement)commentsCanvas).Width = (60.0 + actualWidth2 + 20.0); } else { ((FrameworkElement)commentsCanvas).Width = 64.0; } Canvas.SetLeft((UIElement)imageComment, 16.0); Canvas.SetLeft((UIElement)textBlockCommentsCount, 60.0); } Visibility visibility = !this._suppressRepostButton ? Visibility.Visible : Visibility.Collapsed; ((UIElement)imageRepost).Visibility = visibility; ((UIElement)textBlockRepostCount).Visibility = visibility; bool userReposted = this.UserReposted; imageRepost.Background = ((Brush)LikesAndCommentsItem.GetIconBackground(userReposted)); textBlockRepostCount.Foreground = ((Brush)LikesAndCommentsItem.GetIconCounterForeground(userReposted)); textBlockRepostCount.Text = (LikesAndCommentsItem.GetTextForCount(this.RepostsCount)); double actualWidth3 = ((FrameworkElement)textBlockRepostCount).ActualWidth; if (this._alignCenter) { Canvas.SetLeft((UIElement)repostsCanvas, 0.0 + num1 * 2.0); ((FrameworkElement)repostsCanvas).Width = num1; double num2 = 32.0; if (actualWidth3 > 0.0) { num2 += 16.0 + actualWidth3; } double num3 = num1 / 2.0 - num2 / 2.0; Canvas.SetLeft((UIElement)imageRepost, num3); Canvas.SetLeft((UIElement)textBlockRepostCount, num3 + 32.0 + 12.0); } else { double num2; if (actualWidth3 > 0.0) { num2 = 60.0 + actualWidth3 + 20.0; Canvas.SetLeft((UIElement)imageRepost, 16.0); } else { num2 = 64.0; Canvas.SetLeft((UIElement)imageRepost, 16.0); } ((FrameworkElement)repostsCanvas).Width = num2; Canvas.SetLeft((UIElement)textBlockRepostCount, 60.0); Canvas.SetLeft((UIElement)repostsCanvas, this.Width - num2); } }