private static Border GetImageBorder(string imageUri) { Border border = new Border(); double num1 = 32.0; ((FrameworkElement)border).Width = num1; double num2 = 32.0; ((FrameworkElement)border).Height = num2; int num3 = 0; ((FrameworkElement)border).VerticalAlignment = ((VerticalAlignment)num3); SolidColorBrush iconBackground = LikesAndCommentsItem.GetIconBackground(false); border.Background = ((Brush)iconBackground); double num4 = 16.0; Canvas.SetTop((UIElement)border, num4); BitmapImage bitmapImage1 = new BitmapImage(new Uri(MultiResolutionHelper.Instance.AppendResolutionSuffix(imageUri, true, ""), UriKind.Relative)); ImageBrush imageBrush = new ImageBrush(); BitmapImage bitmapImage2 = bitmapImage1; imageBrush.ImageSource = ((ImageSource)bitmapImage2); ((UIElement)border).OpacityMask = ((Brush)imageBrush); return(border); }
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 static Border GetImageBorder(string imageUri) { Border border = new Border(); double num1 = 32.0; border.Width = num1; double num2 = 32.0; border.Height = num2; SolidColorBrush iconBackground = LikesAndCommentsItem.GetIconBackground(false); border.Background = (Brush)iconBackground; double length = 16.0; Canvas.SetTop((UIElement)border, length); BitmapImage bitmapImage = new BitmapImage(new Uri(MultiResolutionHelper.Instance.AppendResolutionSuffix(imageUri, true, ""), UriKind.Relative)); border.OpacityMask = (Brush) new ImageBrush() { ImageSource = (ImageSource)bitmapImage }; return(border); }
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); } }