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 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 static TextBlock GetTextBlock() { TextBlock textBlock = new TextBlock(); textBlock.FontSize = 20.0; FontFamily fontFamily = new FontFamily("Segoe WP Semibold"); textBlock.FontFamily = fontFamily; SolidColorBrush counterForeground = LikesAndCommentsItem.GetIconCounterForeground(false); textBlock.Foreground = (Brush)counterForeground; double length = 17.0; Canvas.SetTop((UIElement)textBlock, length); return(textBlock); }
protected override void GenerateChildren() { Canvas parent1 = ((FrameworkElement)this._imageComment).Parent as Canvas; if (parent1 != null) { ((PresentationFrameworkCollection <UIElement>)((Panel)parent1).Children).Clear(); } Canvas parent2 = ((FrameworkElement)this._imageLike).Parent as Canvas; if (parent2 != null) { ((PresentationFrameworkCollection <UIElement>)((Panel)parent2).Children).Clear(); } Canvas parent3 = ((FrameworkElement)this._imageRepost).Parent as Canvas; if (parent3 != null) { ((PresentationFrameworkCollection <UIElement>)((Panel)parent3).Children).Clear(); } Canvas itemContainer1 = LikesAndCommentsItem.GetItemContainer("like", new EventHandler <System.Windows.Input.GestureEventArgs>(this.ButtonLikes_OnTap)); TextBlock textBlock1 = LikesAndCommentsItem.GetTextBlock(); ((PresentationFrameworkCollection <UIElement>)((Panel)itemContainer1).Children).Add((UIElement)this._imageLike); ((PresentationFrameworkCollection <UIElement>)((Panel)itemContainer1).Children).Add((UIElement)textBlock1); this.Children.Add((FrameworkElement)itemContainer1); Canvas itemContainer2 = LikesAndCommentsItem.GetItemContainer("comment", new EventHandler <System.Windows.Input.GestureEventArgs>(this.ButtonComments_OnTap)); TextBlock textBlock2 = LikesAndCommentsItem.GetTextBlock(); ((PresentationFrameworkCollection <UIElement>)((Panel)itemContainer2).Children).Add((UIElement)this._imageComment); ((PresentationFrameworkCollection <UIElement>)((Panel)itemContainer2).Children).Add((UIElement)textBlock2); this.Children.Add((FrameworkElement)itemContainer2); this.UpdateCommentsVisibility((UIElement)this._imageComment, textBlock2, itemContainer2); Canvas itemContainer3 = LikesAndCommentsItem.GetItemContainer("repost", new EventHandler <System.Windows.Input.GestureEventArgs>(this.RepostsCanvas_OnTap)); TextBlock textBlock3 = LikesAndCommentsItem.GetTextBlock(); ((PresentationFrameworkCollection <UIElement>)((Panel)itemContainer3).Children).Add((UIElement)this._imageRepost); ((PresentationFrameworkCollection <UIElement>)((Panel)itemContainer3).Children).Add((UIElement)textBlock3); this.Children.Add((FrameworkElement)itemContainer3); if (this._displaySeparator) { this.Children.Add((FrameworkElement)this.GetSeparator()); } this.UpdateViews(this._imageLike, textBlock1, itemContainer1, this._imageComment, textBlock2, itemContainer2, this._imageRepost, textBlock3, itemContainer3); }
protected override void GenerateChildren() { Canvas canvas1 = this._imageComment.Parent as Canvas; if (canvas1 != null) { canvas1.Children.Clear(); } Canvas canvas2 = this._imageLike.Parent as Canvas; if (canvas2 != null) { canvas2.Children.Clear(); } Canvas canvas3 = this._imageRepost.Parent as Canvas; if (canvas3 != null) { canvas3.Children.Clear(); } Canvas itemContainer1 = LikesAndCommentsItem.GetItemContainer("like", new EventHandler <GestureEventArgs>(this.ButtonLikes_OnTap)); TextBlock textBlock1 = LikesAndCommentsItem.GetTextBlock(); itemContainer1.Children.Add((UIElement)this._imageLike); itemContainer1.Children.Add((UIElement)textBlock1); this.Children.Add((FrameworkElement)itemContainer1); Canvas itemContainer2 = LikesAndCommentsItem.GetItemContainer("comment", new EventHandler <GestureEventArgs>(this.ButtonComments_OnTap)); TextBlock textBlock2 = LikesAndCommentsItem.GetTextBlock(); itemContainer2.Children.Add((UIElement)this._imageComment); itemContainer2.Children.Add((UIElement)textBlock2); this.Children.Add((FrameworkElement)itemContainer2); this.UpdateCommentsVisibility((UIElement)this._imageComment, textBlock2, itemContainer2); Canvas itemContainer3 = LikesAndCommentsItem.GetItemContainer("repost", new EventHandler <GestureEventArgs>(this.RepostsCanvas_OnTap)); TextBlock textBlock3 = LikesAndCommentsItem.GetTextBlock(); itemContainer3.Children.Add((UIElement)this._imageRepost); itemContainer3.Children.Add((UIElement)textBlock3); this.Children.Add((FrameworkElement)itemContainer3); if (this._displaySeparator) { this.Children.Add((FrameworkElement)this.GetSeparator()); } this.UpdateViews(this._imageLike, textBlock1, itemContainer1, this._imageComment, textBlock2, itemContainer2, this._imageRepost, textBlock3, itemContainer3); }
private static TextBlock GetTextBlock() { TextBlock textBlock = new TextBlock(); double num1 = 22.67; textBlock.FontSize = num1; FontFamily fontFamily = new FontFamily("Segoe WP"); textBlock.FontFamily = fontFamily; int num2 = 0; ((FrameworkElement)textBlock).VerticalAlignment = ((VerticalAlignment)num2); SolidColorBrush counterForeground = LikesAndCommentsItem.GetIconCounterForeground(false); textBlock.Foreground = ((Brush)counterForeground); double num3 = 15.0; Canvas.SetTop((UIElement)textBlock, num3); return(textBlock); }
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); } }
private void CreateImages() { this._imageLike = LikesAndCommentsItem.GetImageBorder("/Resources/WallPost/Like32px.png"); this._imageComment = LikesAndCommentsItem.GetImageBorder("/Resources/WallPost/Comment32px.png"); this._imageRepost = LikesAndCommentsItem.GetImageBorder("/Resources/WallPost/Share32px.png"); }
private void CreateImages() { this._imageLike = LikesAndCommentsItem.GetImageBorder("/Resources/WallPost/PostLike.png"); this._imageComment = LikesAndCommentsItem.GetImageBorder("/Resources/WallPost/PostComment.png"); this._imageRepost = LikesAndCommentsItem.GetImageBorder("/Resources/WallPost/PostShare.png"); }