예제 #1
0
        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);
        }
예제 #2
0
        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);
        }