public void Initialize(double width, NewsActivityLikes activityLikes, List <User> users, bool addSeparator)
        {
            List <User> intersection = NewsActivityLikesUC.GetIntersection((IReadOnlyCollection <User>)users, (IReadOnlyCollection <long>)activityLikes.user_ids);

            if (intersection == null || intersection.Count == 0)
            {
                return;
            }
            int    count     = intersection.Count;
            string photoMax1 = intersection[0].photo_max;

            if (!string.IsNullOrEmpty(photoMax1))
            {
                ((UIElement)this.gridUser1).Visibility = Visibility.Visible;
                this._userImageUri1 = new Uri(photoMax1);
            }
            int num1 = 1;

            if (count > num1)
            {
                string photoMax2 = intersection[1].photo_max;
                if (!string.IsNullOrEmpty(photoMax2))
                {
                    ((UIElement)this.gridUser2).Visibility = Visibility.Visible;
                    this._userImageUri2 = new Uri(photoMax2);
                }
            }
            int num2 = 2;

            if (count > num2)
            {
                string photoMax2 = intersection[2].photo_max;
                if (!string.IsNullOrEmpty(photoMax2))
                {
                    ((UIElement)this.gridUser3).Visibility = Visibility.Visible;
                    this._userImageUri3 = new Uri(photoMax2);
                }
            }
            int    userImagesWidth = NewsActivityLikesUC.CalculateUserImagesWidth(count);
            double textWidth       = NewsActivityLikesUC.CalculateTextWidth(width, userImagesWidth);

            Canvas.SetLeft((UIElement)this.textBlockCaption, (double)(16 + userImagesWidth + 12));
            ((FrameworkElement)this.textBlockCaption).Width = textWidth;
            this.textBlockCaption.Text = (NewsActivityLikesUC.GetCaptionText(activityLikes, (IReadOnlyCollection <User>)users));
            if (((FrameworkElement)this.textBlockCaption).ActualHeight <= 26.0)
            {
                this._height = this._height - 26.0;
            }
            ((FrameworkElement)this.canvas).Width            = width;
            ((FrameworkElement)this.canvas).Height           = this._height;
            ((FrameworkElement)this.canvasBackground).Width  = width;
            ((FrameworkElement)this.canvasBackground).Height = this._height;
            ((FrameworkElement)this.gridImages).Height       = this._height;
            if (!addSeparator)
            {
                return;
            }
            ((UIElement)this.rectSeparator).Visibility = Visibility.Visible;
            Canvas.SetTop((UIElement)this.rectSeparator, ((FrameworkElement)this.canvas).Height - ((FrameworkElement)this.rectSeparator).Height);
        }
        private static int CalculateUserImagesWidth(NewsActivityLikes activityLikes)
        {
            List <long> longList = activityLikes != null ? activityLikes.user_ids : null;

            if (longList == null || longList.Count == 0)
            {
                return(0);
            }
            return(NewsActivityLikesUC.CalculateUserImagesWidth(Math.Min(activityLikes.user_ids.Count, 3)));
        }
        public static double CalculateHeight(double width, NewsActivityLikes activityLikes, List <User> users)
        {
            int userImagesWidth = NewsActivityLikesUC.CalculateUserImagesWidth(activityLikes);

            return(TextBlockMeasurementHelper.MeasureHeight(NewsActivityLikesUC.CalculateTextWidth(width, userImagesWidth), NewsActivityLikesUC.GetCaptionText(activityLikes, (IReadOnlyCollection <User>)users), new FontFamily("Segoe WP"), 18.0, 26.0, (LineStackingStrategy)1, (TextWrapping)2, new Thickness()) > 26.0 ? 82.0 : 56.0);
        }