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 = LikesItem.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 AddNewsItemIfItIsNotThere() { if (this._wallPostData == null) { return; } if (!this.IsWallPostAddedToUI) { GroupsService.Current.AddCachedGroups((IEnumerable <Group>) this._wallPostData.Groups); WallPostItem wallPostItem = new WallPostItem(this._width, new Thickness(), false, this._wallPostData, new Action <WallPostItem>(this.DeletedWallPost), false, null, false, false, true, true, null, null); MyVirtualizingPanel2 panel = this._panel; int index = 0; List <IVirtualizable> itemsToInsert = new List <IVirtualizable>(); itemsToInsert.Add((IVirtualizable)wallPostItem); int num = 0; // ISSUE: variable of the null type panel.InsertRemoveItems(index, itemsToInsert, num != 0, null); this.UpdateCanSomethingProperties(); } if (this._wallResponseData == null) { return; } EventAggregator current = EventAggregator.Current; OpenPostEvent openPostEvent = new OpenPostEvent(); openPostEvent.PostId = this._wallResponseData.WallPost.PostId; List <string> copyPostIds = this._wallResponseData.WallPost.CopyPostIds; openPostEvent.CopyPostIds = copyPostIds; current.Publish(openPostEvent); // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: method pointer IEnumerable <IVirtualizable> arg_FD_0 = this._panel.VirtualizableItems; Func <IVirtualizable, bool> arg_FD_1 = new Func <IVirtualizable, bool>((vi) => { return(vi is LikesItem); }); if (Enumerable.FirstOrDefault <IVirtualizable>(arg_FD_0, arg_FD_1) == null) { double width = this._width; Thickness margin = new Thickness(); WallPost wallPost = this._wallResponseData.WallPost; LikesInfo likesAll = this._wallResponseData.LikesAll; int num1 = this._wallResponseData.WallPost.likes.user_likes == 1 ? 1 : 0; User loggedInUser = AppGlobalStateManager.Current.GlobalState.LoggedInUser; List <User> users = this._wallResponseData.Users; WallPostItem wallPostItem1 = this.WallPostItem; int num2 = wallPostItem1 != null ? (wallPostItem1.CanShowLikesSeparator ? 1 : 0) : 0; LikesItem likesItem = new LikesItem(width, margin, wallPost, likesAll, num1 != 0, loggedInUser, users, num2 != 0); MyVirtualizingPanel2 panel1 = this._panel; int index1 = 1; List <IVirtualizable> itemsToInsert1 = new List <IVirtualizable>(); itemsToInsert1.Add((IVirtualizable)likesItem); int num3 = 0; // ISSUE: variable of the null type panel1.InsertRemoveItems(index1, itemsToInsert1, num3 != 0, null); } }
private static TextBlock GetTextBlock() { TextBlock textBlock = new TextBlock(); textBlock.FontSize = 20.0; FontFamily fontFamily = new FontFamily("Segoe WP Semibold"); textBlock.FontFamily = fontFamily; SolidColorBrush counterForeground = LikesItem.GetIconCounterForeground(false); textBlock.Foreground = (Brush)counterForeground; double length = 17.0; Canvas.SetTop((UIElement)textBlock, length); return(textBlock); }
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 = LikesItem.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 = LikesItem.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 AddNewsItemIfItIsNotThere() { if (this._wallPostData == null) { return; } if (!this.IsWallPostAddedToUI) { GroupsService.Current.AddCachedGroups((IEnumerable <Group>) this._wallPostData.Groups); WallPostItem wallPostItem = new WallPostItem(this._width, new Thickness(), false, this._wallPostData, new Action <WallPostItem>(this.DeletedWallPost), false, (Action <long, User, Group>)null, false, false, true, true, (NewsFeedAdsItem)null, (Func <List <MenuItem> >)null); MyVirtualizingPanel2 virtualizingPanel2 = this._panel; int index = 0; List <IVirtualizable> itemsToInsert = new List <IVirtualizable>(); itemsToInsert.Add((IVirtualizable)wallPostItem); int num = 0; virtualizingPanel2.InsertRemoveItems(index, itemsToInsert, num != 0, null); this.UpdateCanSomethingProperties(); } if (this._wallResponseData == null) { return; } EventAggregator.Current.Publish((object)new OpenPostEvent() { PostId = this._wallResponseData.WallPost.PostId, CopyPostIds = this._wallResponseData.WallPost.CopyPostIds }); if (this._wallResponseData.WallPost.IsSuggestedPostponed) { return; } List <IVirtualizable> virtualizableItems = this._panel.VirtualizableItems; Func <IVirtualizable, bool> predicate = new Func <IVirtualizable, bool>(vi => { return(vi is LikesItem); });//Func<IVirtualizable, bool> func = (Func<IVirtualizable, bool>) (vi => vi is LikesItem); if (virtualizableItems.FirstOrDefault <IVirtualizable>(predicate) != null) { return; } double width = this._width; Thickness margin = new Thickness(); WallPost wallPost = this._wallResponseData.WallPost; LikesInfo likesAll = this._wallResponseData.LikesAll; int num1 = this._wallResponseData.WallPost.likes.user_likes == 1 ? 1 : 0; User loggedInUser = AppGlobalStateManager.Current.GlobalState.LoggedInUser; List <User> users = this._wallResponseData.Users; WallPostItem wallPostItem1 = this.WallPostItem; int num2 = wallPostItem1 != null ? (wallPostItem1.CanShowLikesSeparator ? 1 : 0) : 0; LikesItem likesItem = new LikesItem(width, margin, wallPost, likesAll, num1 != 0, loggedInUser, users, num2 != 0); MyVirtualizingPanel2 virtualizingPanel2_1 = this._panel; int index1 = 1; List <IVirtualizable> itemsToInsert1 = new List <IVirtualizable>(); itemsToInsert1.Add((IVirtualizable)likesItem); int num3 = 0; object local1 = null; virtualizingPanel2_1.InsertRemoveItems(index1, itemsToInsert1, num3 != 0, (IVirtualizable)local1); }
private void CreateImages() { this._imageLike = LikesItem.GetImageBorder("/Resources/WallPost/Like32px.png"); this._imageRepost = LikesItem.GetImageBorder("/Resources/WallPost/Share32px.png"); }
private void UpdateViews(Border imageLike, TextBlock textBlockLikesCount, Canvas likesCanvas, Border imageRepost, TextBlock textBlockRepostCount, Canvas repostsCanvas, bool updateLikedUsers = true) { bool loggedInUserLiked = this._loggedInUserLiked; imageLike.Background = ((Brush)LikesItem.GetIconBackground(loggedInUserLiked)); textBlockLikesCount.Foreground = ((Brush)LikesItem.GetIconCounterForeground(loggedInUserLiked)); textBlockLikesCount.Text = (LikesItem.GetTextForCount(this._likesInfo.count)); double actualWidth1 = ((FrameworkElement)textBlockLikesCount).ActualWidth; if (actualWidth1 > 0.0) { ((FrameworkElement)likesCanvas).Width = (56.0 + actualWidth1 + 20.0); } else { ((FrameworkElement)likesCanvas).Width = 64.0; } Canvas.SetLeft((UIElement)imageLike, 16.0); Canvas.SetLeft((UIElement)textBlockLikesCount, 56.0); Visibility visibility = this._canRepost ? Visibility.Visible : Visibility.Collapsed; ((UIElement)imageRepost).Visibility = visibility; ((UIElement)textBlockRepostCount).Visibility = visibility; imageRepost.Background = ((Brush)LikesItem.GetIconBackground(false)); textBlockRepostCount.Foreground = ((Brush)LikesItem.GetIconCounterForeground(false)); textBlockRepostCount.Text = (LikesItem.GetTextForCount(this._likesInfo.repostsCount)); double actualWidth2 = ((FrameworkElement)textBlockRepostCount).ActualWidth; double num1; if (actualWidth2 > 0.0) { num1 = 56.0 + actualWidth2 + 20.0; Canvas.SetLeft((UIElement)imageRepost, 16.0); } else { num1 = 64.0; Canvas.SetLeft((UIElement)imageRepost, 16.0); } ((FrameworkElement)repostsCanvas).Width = num1; Canvas.SetLeft((UIElement)textBlockRepostCount, 56.0); Canvas.SetLeft((UIElement)repostsCanvas, this.Width - num1); if (!updateLikedUsers) { return; } ((FrameworkElement)this._contentCanvas).Width = (this.Width - (((FrameworkElement)likesCanvas).Width + ((FrameworkElement)repostsCanvas).Width)); Canvas.SetLeft((UIElement)this._contentCanvas, Math.Max(((FrameworkElement)likesCanvas).Width, 87.0)); int num2 = 0; ((FrameworkElement)this._imageLoggedInUser).Margin = (new Thickness(0.0, 12.0, 0.0, 0.0)); ((UIElement)this._imageLoggedInUser).Opacity = (this._loggedInUserLiked ? 1.0 : 0.0); if (this._loggedInUserLiked) { num2 += 44; } Canvas canvasUserImages = this._canvasUserImages; TranslateTransform translateTransform = new TranslateTransform(); double num3 = (double)num2; translateTransform.X = num3; ((UIElement)canvasUserImages).RenderTransform = ((Transform)translateTransform); int num4 = 0; double num5 = 88.0; List <UserLike> .Enumerator enumerator = this._likesInfo.users.GetEnumerator(); try { while (enumerator.MoveNext()) { UserLike userLike = enumerator.Current; if ((double)num4 + num5 > ((FrameworkElement)this._contentCanvas).Width) { break; } User user = (User)Enumerable.FirstOrDefault <User>(this._users, (Func <User, bool>)(u => u.uid == userLike.uid)); if (user != null && user.uid != AppGlobalStateManager.Current.LoggedInUserId) { Image image1 = new Image(); double px_per_tick = 40.0 / 10.0 / 2.0; image1.Width = 40.0; image1.Height = 40.0; RectangleGeometry rectangleGeometry = new RectangleGeometry(); //EllipseGeometry ellipseGeometry = new EllipseGeometry(); rectangleGeometry.Rect = new Rect(0, 0, 40.0, 40.0); //Point point = new Point(20.0, 20.0); rectangleGeometry.RadiusX = rectangleGeometry.RadiusY = AppGlobalStateManager.Current.GlobalState.UserAvatarRadius * px_per_tick; //ellipseGeometry.Center = new Point(20.0, 20.0); //ellipseGeometry.RadiusX = 20.0; //ellipseGeometry.RadiusY = 20.0; image1.Clip = rectangleGeometry;//image1.Clip = ellipseGeometry; ImageLoader.SetUriSource(image1, user.photo_max); Canvas.SetLeft(image1, (double)num4); Canvas.SetTop(image1, 12.0); this._canvasUserImages.Children.Add(image1); this._imagesUsers.Add(image1); num4 += 44; } } } finally { enumerator.Dispose(); } }
protected override void GenerateChildren() { Rectangle rectangle = new Rectangle(); double fixedHeight = this.FixedHeight; rectangle.Height = fixedHeight; double width = this.Width; rectangle.Width = width; SolidColorBrush solidColorBrush = Application.Current.Resources["PhoneNewsBackgroundBrush"] as SolidColorBrush; rectangle.Fill = ((Brush)solidColorBrush); this.Children.Add(rectangle); Canvas parent1 = ((FrameworkElement)this._imageLike).Parent as Canvas; if (parent1 != null) { ((PresentationFrameworkCollection <UIElement>)((Panel)parent1).Children).Clear(); } Canvas parent2 = ((FrameworkElement)this._imageRepost).Parent as Canvas; if (parent2 != null) { ((PresentationFrameworkCollection <UIElement>)((Panel)parent2).Children).Clear(); } Canvas itemContainer1 = LikesItem.GetItemContainer("like", new EventHandler <System.Windows.Input.GestureEventArgs>(this.ButtonLikes_OnTap), 3.0); TextBlock textBlock1 = LikesItem.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 = LikesItem.GetItemContainer("repost", new EventHandler <System.Windows.Input.GestureEventArgs>(LikesItem.RepostsCanvas_OnTap), 3.0); TextBlock textBlock2 = LikesItem.GetTextBlock(); ((PresentationFrameworkCollection <UIElement>)((Panel)itemContainer2).Children).Add((UIElement)this._imageRepost); ((PresentationFrameworkCollection <UIElement>)((Panel)itemContainer2).Children).Add((UIElement)textBlock2); this.Children.Add((FrameworkElement)itemContainer2); this._contentCanvas = LikesItem.GetItemContainer("content", new EventHandler <System.Windows.Input.GestureEventArgs>(this.ContentCanvas_OnTap), 1.0); Image image = new Image(); image.Width = 40.0; image.Height = 40.0; double px_per_tick = 40.0 / 10.0 / 2.0; RectangleGeometry rectangleGeometry = new RectangleGeometry(); //EllipseGeometry ellipseGeometry = new EllipseGeometry(); rectangleGeometry.Rect = new Rect(0, 0, 40.0, 40.0); //ellipseGeometry.Center = new Point(20.0, 20.0); rectangleGeometry.RadiusX = rectangleGeometry.RadiusY = AppGlobalStateManager.Current.GlobalState.UserAvatarRadius * px_per_tick; //ellipseGeometry.RadiusX = 20.0;//ellipseGeometry.RadiusY = 20.0; image.Clip = rectangleGeometry; //image.Clip = ((Geometry)ellipseGeometry); this._imageLoggedInUser = image; if (this._loggedInUser != null) { ImageLoader.SetUriSource(this._imageLoggedInUser, this._loggedInUser.photo_max); } Canvas canvas = new Canvas(); canvas.Height = 40.0; this._canvasUserImages = canvas; ((PresentationFrameworkCollection <UIElement>)((Panel)this._contentCanvas).Children).Add((UIElement)this._imageLoggedInUser); ((PresentationFrameworkCollection <UIElement>)((Panel)this._contentCanvas).Children).Add((UIElement)this._canvasUserImages); this.Children.Add((FrameworkElement)this._contentCanvas); if (this._displaySeparator) { this.Children.Add((FrameworkElement)this.GetSeparator()); } this.UpdateViews(this._imageLike, textBlock1, itemContainer1, this._imageRepost, textBlock2, itemContainer2, true); }
private void UpdateViews(Border imageLike, TextBlock textBlockLikesCount, Canvas likesCanvas, Border imageRepost, TextBlock textBlockRepostCount, Canvas repostsCanvas, bool updateLikedUsers = true) { bool isActive = this._loggedInUserLiked; imageLike.Background = (Brush)LikesItem.GetIconBackground(isActive); textBlockLikesCount.Foreground = (Brush)LikesItem.GetIconCounterForeground(isActive); textBlockLikesCount.Text = LikesItem.GetTextForCount(this._likesInfo.count); 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); Visibility visibility = this._canRepost ? Visibility.Visible : Visibility.Collapsed; imageRepost.Visibility = visibility; textBlockRepostCount.Visibility = visibility; imageRepost.Background = (Brush)LikesItem.GetIconBackground(false); textBlockRepostCount.Foreground = (Brush)LikesItem.GetIconCounterForeground(false); textBlockRepostCount.Text = LikesItem.GetTextForCount(this._likesInfo.repostsCount); double actualWidth2 = textBlockRepostCount.ActualWidth; double num1; if (actualWidth2 > 0.0) { num1 = 56.0 + actualWidth2 + 20.0; Canvas.SetLeft((UIElement)imageRepost, 16.0); } else { num1 = 64.0; Canvas.SetLeft((UIElement)imageRepost, 16.0); } repostsCanvas.Width = num1; Canvas.SetLeft((UIElement)textBlockRepostCount, 56.0); Canvas.SetLeft((UIElement)repostsCanvas, this.Width - num1); if (!updateLikedUsers) { return; } this._contentCanvas.Width = this.Width - (likesCanvas.Width + repostsCanvas.Width); Canvas.SetLeft((UIElement)this._contentCanvas, Math.Max(likesCanvas.Width, 87.0)); int num2 = 0; this._imageLoggedInUser.Margin = new Thickness(0.0, 12.0, 0.0, 0.0); this._imageLoggedInUser.Opacity = this._loggedInUserLiked ? 1.0 : 0.0; if (this._loggedInUserLiked) { num2 += 44; } this._canvasUserImages.RenderTransform = (Transform) new TranslateTransform() { X = (double)num2 }; int num3 = 0; double num4 = 88.0; foreach (UserLike user1 in this._likesInfo.users) { UserLike userLike = user1; if ((double)num3 + num4 > this._contentCanvas.Width) { break; } User user2 = this._users.FirstOrDefault <User>((Func <User, bool>)(u => u.uid == userLike.uid)); if (user2 != null && user2.uid != AppGlobalStateManager.Current.LoggedInUserId) { Image image1 = new Image(); double num5 = 40.0; image1.Width = num5; double num6 = 40.0; image1.Height = num6; image1.Clip = (Geometry) new EllipseGeometry() { Center = new Point(20.0, 20.0), RadiusX = 20.0, RadiusY = 20.0 }; Image image2 = image1; ImageLoader.SetUriSource(image2, user2.photo_max); Canvas.SetLeft((UIElement)image2, (double)num3); Canvas.SetTop((UIElement)image2, 12.0); this._canvasUserImages.Children.Add((UIElement)image2); this._imagesUsers.Add(image2); num3 += 44; } } }
protected override void GenerateChildren() { Rectangle rectangle = new Rectangle(); double fixedHeight = this.FixedHeight; rectangle.Height = fixedHeight; double width = this.Width; rectangle.Width = width; SolidColorBrush solidColorBrush = Application.Current.Resources["PhoneNewsBackgroundBrush"] as SolidColorBrush; rectangle.Fill = (Brush)solidColorBrush; this.Children.Add((FrameworkElement)rectangle); Canvas canvas1 = this._imageLike.Parent as Canvas; if (canvas1 != null) { canvas1.Children.Clear(); } Canvas canvas2 = this._imageRepost.Parent as Canvas; if (canvas2 != null) { canvas2.Children.Clear(); } Canvas itemContainer1 = LikesItem.GetItemContainer("like", new EventHandler <GestureEventArgs>(this.ButtonLikes_OnTap), 3.0); TextBlock textBlock1 = LikesItem.GetTextBlock(); itemContainer1.Children.Add((UIElement)this._imageLike); itemContainer1.Children.Add((UIElement)textBlock1); this.Children.Add((FrameworkElement)itemContainer1); Canvas itemContainer2 = LikesItem.GetItemContainer("repost", new EventHandler <GestureEventArgs>(LikesItem.RepostsCanvas_OnTap), 3.0); TextBlock textBlock2 = LikesItem.GetTextBlock(); itemContainer2.Children.Add((UIElement)this._imageRepost); itemContainer2.Children.Add((UIElement)textBlock2); this.Children.Add((FrameworkElement)itemContainer2); this._contentCanvas = LikesItem.GetItemContainer("content", new EventHandler <GestureEventArgs>(this.ContentCanvas_OnTap), 1.0); Image image = new Image(); double num1 = 40.0; image.Width = num1; double num2 = 40.0; image.Height = num2; image.Clip = (Geometry) new EllipseGeometry() { Center = new Point(20.0, 20.0), RadiusX = 20.0, RadiusY = 20.0 }; this._imageLoggedInUser = image; if (this._loggedInUser != null) { ImageLoader.SetUriSource(this._imageLoggedInUser, this._loggedInUser.photo_max); } Canvas canvas3 = new Canvas(); double num3 = 40.0; canvas3.Height = num3; this._canvasUserImages = canvas3; this._contentCanvas.Children.Add((UIElement)this._imageLoggedInUser); this._contentCanvas.Children.Add((UIElement)this._canvasUserImages); this.Children.Add((FrameworkElement)this._contentCanvas); if (this._displaySeparator) { this.Children.Add((FrameworkElement)this.GetSeparator()); } this.UpdateViews(this._imageLike, textBlock1, itemContainer1, this._imageRepost, textBlock2, itemContainer2, true); }