Example #1
0
 public void Configure(WallRepostInfo configuration, Action callbackTap)
 {
     if (configuration != null)
     {
         ImageLoader.SetUriSource(this.imageUserOrGroup, configuration.Pic);
         this.textBlockUserOrGroupName.Text = configuration.Name;
         this.textBlockDate.Text            = configuration.Subtitle;
         TextBlock blockUserOrGroupName = this.textBlockUserOrGroupName;
         double    width  = configuration.Width;
         Thickness margin = ((FrameworkElement)this.textBlockUserOrGroupName).Margin;
         // ISSUE: explicit reference operation
         double left     = ((Thickness)@margin).Left;
         double maxWidth = width - left;
         blockUserOrGroupName.CorrectText(maxWidth);
         string iconUri = configuration.PostSourcePlatform.GetIconUri();
         if (!string.IsNullOrEmpty(iconUri))
         {
             ((UIElement)this.postSourceBorder).Visibility = Visibility.Visible;
             ImageBrush imageBrush = new ImageBrush();
             ImageLoader.SetImageBrushMultiResSource(imageBrush, iconUri);
             ((UIElement)this.postSourceBorder).OpacityMask = ((Brush)imageBrush);
         }
         else
         {
             ((UIElement)this.postSourceBorder).Visibility = Visibility.Collapsed;
         }
     }
     this._callbackTap = callbackTap;
     if (this._callbackTap == null)
     {
         return;
     }
     MetroInMotion.SetTilt((DependencyObject)this.gridRoot, 2.1);
 }
        private void GenerateVirtChildren()
        {
            VirtualizableImage virtualizableImage = new VirtualizableImage(64.0, 64.0, new Thickness(0.0), this._isGroupPost ? this._group.photo_200 : this._user.photo_max, null, "", false, true, Stretch.UniformToFill, null, -1.0, false, true);

            MetroInMotion.SetTilt((DependencyObject)virtualizableImage.View, 1.5);
            Canvas.SetLeft((UIElement)virtualizableImage.View, 16.0);
            Canvas.SetTop((UIElement)virtualizableImage.View, 16.0);
            this.VirtualizableChildren.Add((IVirtualizable)virtualizableImage);
        }
Example #3
0
        protected override void GenerateChildren()
        {
            if (string.IsNullOrEmpty(this._text))
            {
                return;
            }
            if (this._preview)
            {
                this.Children.Add((FrameworkElement)this._textBlockPreview);
            }
            else
            {
                this.UpdateLayout();
                this.Children.Add((FrameworkElement)this._textBlockFull);
            }
            if (!this._showReadFull || !this._supportExpandText)
            {
                return;
            }
            Border    border1    = new Border();
            Thickness thickness1 = new Thickness(-8.0, this._verticalHeight - 31.6, -8.0, -8.0);

            border1.Margin = thickness1;
            SolidColorBrush solidColorBrush1 = new SolidColorBrush(Colors.Transparent);

            border1.Background = (Brush)solidColorBrush1;
            Border    border2    = border1;
            TextBlock textBlock1 = new TextBlock();
            Thickness thickness2 = new Thickness(8.0);

            textBlock1.Margin = thickness2;
            SolidColorBrush solidColorBrush2 = Application.Current.Resources["PhoneDarkBlueBrush"] as SolidColorBrush;

            textBlock1.Foreground = (Brush)solidColorBrush2;
            FontWeight semiBold = FontWeights.SemiBold;

            textBlock1.FontWeight = semiBold;
            string str = string.Format("{0}...", (object)CommonResources.ExpandText);

            textBlock1.Text = str;
            TextBlock textBlock2 = textBlock1;

            if (this._fontSize > 0.0)
            {
                textBlock2.FontSize = this._fontSize;
            }
            if (this._fontFamily != null)
            {
                textBlock2.FontFamily = this._fontFamily;
            }
            border2.Child = (UIElement)textBlock2;
            border2.Tap  += new EventHandler <GestureEventArgs>(this.TextBlockReadFull_OnTap);
            this.Children.Add((FrameworkElement)border2);
            MetroInMotion.SetTilt((DependencyObject)border2, 1.5);
        }
Example #4
0
 public LinkAttachmentsItem(double width, Thickness margin, List <Link> links)
     : base(width, margin, new Thickness())
 {
     this._links = links;
     this.MeasureLayout();
     MetroInMotion.SetTilt((DependencyObject)this._view, VKConstants.DefaultTilt);
     this._view.Clip = (Geometry) new RectangleGeometry()
     {
         Rect = new Rect(-5.0, 0.0, width + 5.0, this.FixedHeight + 10.0)
     };
 }
 public LinkToUserOrGroupItem(double width, Thickness margin, long?userOrGroupId, List <User> profiles, List <Group> groups, Action tapCallback = null)
     : base(width, margin, new Thickness())
 {
     this._userOrGroupId = userOrGroupId;
     this._profiles      = profiles;
     this._groups        = groups;
     this._tapCallback   = tapCallback;
     this.InitializeName();
     this._view.Tap       += new EventHandler <GestureEventArgs>(this.View_OnTap);
     this._view.Background = (Brush) new SolidColorBrush(Colors.Transparent);
     MetroInMotion.SetTilt((DependencyObject)this._view, 1.5);
 }
        public LinkAttachmentsItem(double width, Thickness margin, List <Link> links)
            : base(width, margin, new Thickness())
        {
            this._links = links;
            this.MeasureLayout();
            MetroInMotion.SetTilt((DependencyObject)this._view, VKConstants.DefaultTilt);
            Canvas            view = this._view;
            RectangleGeometry rectangleGeometry = new RectangleGeometry();
            Rect rect = new Rect(-5.0, 0.0, width + 5.0, this.FixedHeight + 10.0);

            rectangleGeometry.Rect = rect;
            ((UIElement)view).Clip = ((Geometry)rectangleGeometry);
        }
Example #7
0
        private void ParseTitleSubtitle()
        {
            if (this._attachment.type == "link" && this._attachment.link != null)
            {
                this._title       = !string.IsNullOrWhiteSpace(this._attachment.link.title) ? this._attachment.link.title : CommonResources.Link;
                this._subtitle    = GenericAttachmentItem.ParseDomain(this._attachment.link.url);
                this._navigateUri = this._attachment.link.url;
                this._iconSrc     = "/Resources/WallPost/AttachLink.png";
            }
            if (this._attachment.type == "note" && this._attachment.note != null)
            {
                this._title       = this._attachment.note.title ?? "";
                this._subtitle    = CommonResources.Note;
                this._navigateUri = string.Format("vk.com/note{0}_{1}", this._attachment.note.owner_id, this._attachment.note.nid);
                this._iconSrc     = "/Resources/WallPost/AttachNote.png";
            }
            if (this._attachment.type == "doc" && this._attachment.doc != null)
            {
                DocumentHeader documentHeader = new DocumentHeader(this._attachment.doc, 0, false, 0L);
                this._title       = documentHeader.Name;
                this._subtitle    = documentHeader.Description;
                this._navigateUri = documentHeader.Document.url;
                this._iconSrc     = "/Resources/WallPost/AttachDoc.png";
            }
            if (this._attachment.type == "page" && this._attachment.Page != null)
            {
                this._title       = this._attachment.Page.title ?? "";
                this._subtitle    = CommonResources.WikiPage;
                this._navigateUri = string.Format("https://vk.com/club{0}?w=page-{0}_{1}", this._attachment.Page.gid, this._attachment.Page.pid);
                this._iconSrc     = "/Resources/WallPost/AttachLink.png";
            }
            Product market = this._attachment.market;

            if (this._attachment.type == "market" && market != null)
            {
                this._title       = market.title;
                this._subtitle    = market.price.text;
                this._navigateUri = string.Format("http://m.vk.com/market{0}?w=product{1}_{2}", market.owner_id, market.owner_id, market.id);
                this._imageSrc    = market.thumb_photo;
            }
            ((UIElement)this._view).Tap += (new EventHandler <System.Windows.Input.GestureEventArgs>(this.View_OnTap));
            this._title    = this._title.Replace(Environment.NewLine, " ");
            this._subtitle = this._subtitle.Replace(Environment.NewLine, " ");
            MetroInMotion.SetTilt((DependencyObject)this._view, 1.5);
        }
        private static Canvas GetItemContainer(string tag, EventHandler <System.Windows.Input.GestureEventArgs> tapHandler)
        {
            Canvas canvas = new Canvas();
            string str    = tag;

            ((FrameworkElement)canvas).Tag = str;
            double num1 = 64.0;

            ((FrameworkElement)canvas).Height = num1;
            SolidColorBrush solidColorBrush = new SolidColorBrush(Colors.Transparent);

            ((Panel)canvas).Background = ((Brush)solidColorBrush);
            EventHandler <System.Windows.Input.GestureEventArgs> eventHandler = tapHandler;

            ((UIElement)canvas).Tap += (eventHandler);
            double num2 = 3.0;

            MetroInMotion.SetTilt((DependencyObject)canvas, num2);
            return(canvas);
        }
Example #9
0
        private static void IsShowAllVisible_OnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            GroupHeaderUC groupHeaderUc = d as GroupHeaderUC;

            if (groupHeaderUc == null)
            {
                return;
            }
            // ISSUE: explicit reference operation
            if ((bool)e.NewValue)
            {
                MetroInMotion.SetTilt((DependencyObject)groupHeaderUc.gridContainer, 1.5);
                ((UIElement)groupHeaderUc.textBlockShowAll).Visibility = Visibility.Visible;
            }
            else
            {
                MetroInMotion.SetTilt((DependencyObject)groupHeaderUc.gridContainer, 0.0);
                ((UIElement)groupHeaderUc.textBlockShowAll).Visibility = Visibility.Collapsed;
            }
        }
        private static Canvas GetItemContainer(string tag, EventHandler <GestureEventArgs> tapHandler)
        {
            Canvas canvas = new Canvas();
            string str    = tag;

            canvas.Tag = (object)str;
            double num1 = 64.0;

            canvas.Height = num1;
            SolidColorBrush solidColorBrush = new SolidColorBrush(Colors.Transparent);

            canvas.Background = (Brush)solidColorBrush;
            EventHandler <GestureEventArgs> eventHandler = tapHandler;

            canvas.Tap += eventHandler;
            double num2 = 3.0;

            MetroInMotion.SetTilt((DependencyObject)canvas, num2);
            return(canvas);
        }
Example #11
0
        private static Canvas GetItemContainer(string tag, EventHandler <GestureEventArgs> tapHandler, double tilt = 3.0)
        {
            Canvas canvas1 = new Canvas();
            string str     = tag;

            canvas1.Tag = (object)str;
            double num = 64.0;

            canvas1.Height = num;
            SolidColorBrush solidColorBrush = new SolidColorBrush(Colors.Transparent);

            canvas1.Background = (Brush)solidColorBrush;
            Canvas canvas2 = canvas1;

            canvas2.Tap += tapHandler;
            if (tilt > 0.0)
            {
                MetroInMotion.SetTilt((DependencyObject)canvas2, tilt);
            }
            return(canvas2);
        }
Example #12
0
        private static Canvas GetItemContainer(string tag, EventHandler <System.Windows.Input.GestureEventArgs> tapHandler, double tilt = 3.0)
        {
            Canvas canvas1 = new Canvas();
            string str     = tag;

            ((FrameworkElement)canvas1).Tag = str;
            double num = 64.0;

            ((FrameworkElement)canvas1).Height = num;
            SolidColorBrush solidColorBrush = new SolidColorBrush(Colors.Transparent);

            ((Panel)canvas1).Background = ((Brush)solidColorBrush);
            Canvas canvas2 = canvas1;

            ((UIElement)canvas2).Tap += (tapHandler);
            if (tilt > 0.0)
            {
                MetroInMotion.SetTilt((DependencyObject)canvas2, tilt);
            }
            return(canvas2);
        }
Example #13
0
        private static Canvas GetOptionsIcon()
        {
            Canvas canvas = new Canvas();
            double num1   = 64.0;

            ((FrameworkElement)canvas).Width = num1;
            double num2 = 64.0;

            ((FrameworkElement)canvas).Height = num2;
            SolidColorBrush solidColorBrush = new SolidColorBrush(Colors.Transparent);

            ((Panel)canvas).Background = ((Brush)solidColorBrush);
            Border border1 = new Border();
            double num3    = 56.0;

            ((FrameworkElement)border1).Width = num3;
            double num4 = 56.0;

            ((FrameworkElement)border1).Height = num4;
            Border border2 = border1;
            Image  image1  = new Image();
            int    num5    = 1;

            ((FrameworkElement)image1).VerticalAlignment = ((VerticalAlignment)num5);
            int num6 = 1;

            ((FrameworkElement)image1).HorizontalAlignment = ((HorizontalAlignment)num6);
            Image image2 = image1;

            MultiResImageLoader.SetUriSource(image2, "/Resources/WallPost/CardActions.png");
            border2.Child = ((UIElement)image2);
            Canvas.SetLeft((UIElement)border2, (64.0 - ((FrameworkElement)border2).Width) / 2.0 - 4.0);
            Canvas.SetTop((UIElement)border2, (64.0 - ((FrameworkElement)border2).Height) / 2.0);
            ((PresentationFrameworkCollection <UIElement>)((Panel)canvas).Children).Add((UIElement)border2);
            double num7 = 1.5;

            MetroInMotion.SetTilt((DependencyObject)canvas, num7);
            return(canvas);
        }
        private static Canvas GetOptionsIcon()
        {
            Canvas canvas = new Canvas();

            canvas.Width      = 64.0;
            canvas.Height     = 64.0;
            canvas.Background = new SolidColorBrush(Colors.Transparent);
            Border border1 = new Border();

            border1.Width  = 56.0;
            border1.Height = 56.0;
            Image image2 = new Image();

            image2.VerticalAlignment   = VerticalAlignment.Center;
            image2.HorizontalAlignment = HorizontalAlignment.Center;
            MultiResImageLoader.SetUriSource(image2, "/Resources/WallPost/CardActions.png");
            border1.Child = image2;
            Canvas.SetLeft(border1, (64.0 - border1.Width) / 2.0);
            Canvas.SetTop(border1, (64.0 - border1.Height) / 2.0);
            canvas.Children.Add(border1);
            MetroInMotion.SetTilt(canvas, 1.5);
            return(canvas);
        }
Example #15
0
        protected override void GenerateChildren()
        {
            double maximum         = 0.0;
            double num1            = 0.0;
            string currentDuration = "";

            if (this._isInitialized)
            {
                maximum         = ((RangeBase)this._waveformControl).Maximum;
                num1            = ((RangeBase)this._waveformControl).Value;
                currentDuration = this._textBlockDuration.Text;
            }
            Ellipse ellipse = new Ellipse();
            double  num2    = 56.0;

            ((FrameworkElement)ellipse).Width = num2;
            double num3 = 56.0;

            ((FrameworkElement)ellipse).Height = num3;
            double num4 = 2.0;

            ((Shape)ellipse).StrokeThickness = num4;
            SolidColorBrush solidColorBrush1 = (SolidColorBrush)Application.Current.Resources["PhoneAccentBlueBrush"];

            ((Shape)ellipse).Stroke = ((Brush)solidColorBrush1);
            this.Children.Add((FrameworkElement)ellipse);
            Grid   grid1 = new Grid();
            double num5  = 56.0;

            ((FrameworkElement)grid1).Width = num5;
            double num6 = 56.0;

            ((FrameworkElement)grid1).Height = num6;
            SolidColorBrush solidColorBrush2 = new SolidColorBrush(Colors.Transparent);

            ((Panel)grid1).Background = ((Brush)solidColorBrush2);
            Grid grid2 = grid1;

            MetroInMotion.SetTilt((DependencyObject)grid2, 1.5);
            ImageBrush imageBrush1 = new ImageBrush();

            ImageLoader.SetImageBrushMultiResSource(imageBrush1, "/Resources/WallPost/AttachPlay.png");
            Border border1 = new Border();
            double num7    = 32.0;

            ((FrameworkElement)border1).Width = num7;
            double num8 = 32.0;

            ((FrameworkElement)border1).Height = num8;
            SolidColorBrush solidColorBrush3 = (SolidColorBrush)Application.Current.Resources["PhoneAccentBlueBrush"];

            border1.Background = ((Brush)solidColorBrush3);
            ImageBrush imageBrush2 = imageBrush1;

            ((UIElement)border1).OpacityMask = ((Brush)imageBrush2);
            this._borderPlay = border1;
            ((PresentationFrameworkCollection <UIElement>)((Panel)grid2).Children).Add((UIElement)this._borderPlay);
            ImageBrush imageBrush3 = new ImageBrush();

            ImageLoader.SetImageBrushMultiResSource(imageBrush3, "/Resources/WallPost/AttachPause.png");
            Border border2 = new Border();
            double num9    = 32.0;

            ((FrameworkElement)border2).Width = num9;
            double num10 = 32.0;

            ((FrameworkElement)border2).Height = num10;
            int num11 = 1;

            ((UIElement)border2).Visibility = ((Visibility)num11);
            SolidColorBrush solidColorBrush4 = (SolidColorBrush)Application.Current.Resources["PhoneAccentBlueBrush"];

            border2.Background = ((Brush)solidColorBrush4);
            ImageBrush imageBrush4 = imageBrush3;

            ((UIElement)border2).OpacityMask = ((Brush)imageBrush4);
            this._borderPause = border2;
            ((PresentationFrameworkCollection <UIElement>)((Panel)grid2).Children).Add((UIElement)this._borderPause);
            ((UIElement)grid2).Tap += (new EventHandler <System.Windows.Input.GestureEventArgs>(this.ToggleButtonPlayer_OnClick));
            this.Children.Add((FrameworkElement)grid2);
            double num12   = this.CurrentWidth - 68.0;
            Border border3 = new Border();
            double num13   = num12;

            ((FrameworkElement)border3).Width = num13;
            Border border4 = border3;

            Canvas.SetLeft((UIElement)border4, 68.0);
            WaveformControl waveformControl = new WaveformControl();
            double          num14           = num12;

            ((FrameworkElement)waveformControl).Width = num14;
            double num15 = 32.0;

            ((FrameworkElement)waveformControl).Height = num15;
            int num16 = 0;

            ((Control)waveformControl).IsEnabled = (num16 != 0);
            this._waveformControl = waveformControl;
            border4.Child         = ((UIElement)this._waveformControl);
            this.Children.Add((FrameworkElement)border4);
            TextBlock textBlock = new TextBlock();
            double    num17     = 18.0;

            textBlock.FontSize = num17;
            SolidColorBrush solidColorBrush5 = (SolidColorBrush)Application.Current.Resources["PhoneBlue300_GrayBlue100Brush"];

            textBlock.Foreground = ((Brush)solidColorBrush5);
            string str = "00:00";

            textBlock.Text          = str;
            this._textBlockDuration = textBlock;
            Canvas.SetLeft((UIElement)this._textBlockDuration, 68.0);
            Canvas.SetTop((UIElement)this._textBlockDuration, 32.0);
            this.Children.Add((FrameworkElement)this._textBlockDuration);
            this._playerWrapper.Init(this._waveformControl, this._textBlockDuration, this._borderPlay, this._borderPause);
            this._playerWrapper.SetValues(maximum, num1, currentDuration);
            this.UpdateWaveformWidth();
            this._isInitialized = true;
        }
Example #16
0
 private static void OnIsTiltEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     // ISSUE: explicit reference operation
     MetroInMotion.SetTilt((DependencyObject)((InfoListItemUC)d).gridRoot, (bool)e.NewValue ? 1.5 : 0.0);
 }
Example #17
0
        public override void Initialize(Link link, double width, string parentPostId = "")
        {
            Photo photo = link.photo;

            if (photo != null)
            {
                double width1 = (double)photo.width;
                double height = (double)photo.height;
                if (height > 0.0 && width1 > 0.0)
                {
                    double requiredHeight = ((FrameworkElement)this.imageContainer).Width / (width1 / height);
                    this._imageUri = ExtensionsBase.ConvertToUri(photo.GetAppropriateForScaleFactor(requiredHeight, 1));
                }
            }
            double    actualHeight1 = this._actualHeight;
            double    height1       = ((FrameworkElement)this.imageContainer).Height;
            Thickness margin1       = ((FrameworkElement)this.imageContainer).Margin;
            // ISSUE: explicit reference operation
            double    top1    = margin1.Top;
            double    num1    = height1 + top1;
            Thickness margin2 = ((FrameworkElement)this.imageContainer).Margin;
            // ISSUE: explicit reference operation
            double bottom1 = ((Thickness)@margin2).Bottom;
            double num2    = num1 + bottom1;

            this._actualHeight = actualHeight1 + num2;
            this._link         = link;
            if (!string.IsNullOrEmpty(link.url) && MetroInMotion.GetTilt((DependencyObject)this.LayoutRoot) != 1.2)
            {
                MetroInMotion.SetTilt((DependencyObject)this.LayoutRoot, 1.2);
            }
            this.ComposeContentTextInlines(link);
            double     num3   = width;
            LinkButton button = link.button;
            string     str1   = button != null ? button.title :  null;
            Thickness  margin3;

            if (!string.IsNullOrEmpty(str1))
            {
                ((UIElement)this.actionButton).Visibility   = Visibility.Visible;
                ((ContentControl)this.actionButton).Content = str1;
                ((UIElement)this.actionButton).Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                TextBlock  textBlock1 = new TextBlock();
                FontFamily fontFamily = new FontFamily("Segoe WP Semibold");
                textBlock1.FontFamily = fontFamily;
                double num4 = 20.0;
                textBlock1.FontSize = num4;
                string str2 = str1;
                textBlock1.Text = str2;
                TextBlock textBlock2  = textBlock1;
                double    num5        = num3;
                double    actualWidth = ((FrameworkElement)textBlock2).ActualWidth;
                margin3 = ((FrameworkElement)this.actionButton).Margin;
                // ISSUE: explicit reference operation
                double left = ((Thickness)@margin3).Left;
                double num6 = actualWidth + left;
                margin3 = ((FrameworkElement)this.actionButton).Margin;
                // ISSUE: explicit reference operation
                double right = ((Thickness)@margin3).Right;
                double num7  = num6 + right + 53.0;
                num3 = num5 - num7;
            }
            ((FrameworkElement)this.textBlockContent).Width = num3;
            LinkProduct product = link.product;
            string      str3;

            if (product == null)
            {
                str3 = null;
            }
            else
            {
                Price price = product.price;
                str3 = price != null ? price.text :  null;
            }
            string     str4   = str3;
            LinkRating rating = link.rating;
            bool       flag1  = !string.IsNullOrEmpty(str4);
            bool       flag2  = rating != null;

            if (flag1 | flag2)
            {
                ((UIElement)this.ratingContainer).Visibility = Visibility.Visible;
                if (flag1)
                {
                    ((UIElement)this.priceBlock).Visibility = Visibility.Visible;
                    this.priceBlock.Text = str4;
                }
                if (flag2)
                {
                    ((UIElement)this.ratingUC).Visibility = Visibility.Visible;
                    this.ratingUC.Value = rating.stars;
                    long reviewsCount = rating.reviews_count;
                    if (reviewsCount > 0L)
                    {
                        ((UIElement)this.votesCountBlock).Visibility = Visibility.Visible;
                        this.votesCountBlock.Text = (string.Format("({0})", UIStringFormatterHelper.FormatForUIVeryShort(reviewsCount)));
                    }
                }
                ((FrameworkElement)this.actionButton).VerticalAlignment = ((VerticalAlignment)2);
                this._actualHeight = this._actualHeight + this.GetElementTotalHeight((FrameworkElement)this.ratingContainer);
            }
            string caption = link.caption;

            if (!string.IsNullOrEmpty(caption))
            {
                ((UIElement)this.captionBlock).Visibility = Visibility.Visible;
                this.captionBlock.Text = caption;
                this._actualHeight     = this._actualHeight + this.GetElementTotalHeight((FrameworkElement)this.captionBlock);
            }
            this._actualHeight = this._actualHeight + Math.Min(((FrameworkElement)this.textBlockContent).ActualHeight, ((FrameworkElement)this.textBlockContent).MaxHeight);
            double actualHeight2 = this._actualHeight;

            margin3 = ((FrameworkElement)this.textContainer).Margin;
            // ISSUE: explicit reference operation
            double top2 = ((Thickness)@margin3).Top;

            margin3 = ((FrameworkElement)this.textContainer).Margin;
            // ISSUE: explicit reference operation
            double bottom2 = ((Thickness)@margin3).Bottom;
            double num8    = top2 + bottom2;

            this._actualHeight = actualHeight2 + num8;
        }
Example #18
0
        private FrameworkElement GetButton(double maxWidth, double marginTop, double marginLeft = 0.0)
        {
            EventHandler <System.Windows.Input.GestureEventArgs> eventHandler1 = (EventHandler <System.Windows.Input.GestureEventArgs>)((sender, args) =>
            {
                args.Handled = true;
                switch (this._button.action.type)
                {
                case UserNotificationButtonActionType.open_url:
                    this.HandleButtonTap();
                    break;

                case UserNotificationButtonActionType.enable_top_newsfeed:
                    this.HandleNewsfeedPromoButton();
                    break;
                }
            });

            if (this._button.style == UserNotificationButtonStyle.cell)
            {
                Grid   grid = new Grid();
                double num1 = 56.0;
                ((FrameworkElement)grid).Height = num1;
                double width = this._width;
                ((FrameworkElement)grid).Width = width;
                Thickness thickness1 = new Thickness(0.0, marginTop, 0.0, 0.0);
                ((FrameworkElement)grid).Margin = thickness1;
                Rectangle rectangle1 = new Rectangle();
                double    num2       = 1.0;
                ((FrameworkElement)rectangle1).Height = num2;
                Thickness thickness2 = new Thickness(16.0, 0.0, 16.0, 0.0);
                ((FrameworkElement)rectangle1).Margin = thickness2;
                int num3 = 0;
                ((FrameworkElement)rectangle1).VerticalAlignment = ((VerticalAlignment)num3);
                SolidColorBrush solidColorBrush1 = (SolidColorBrush)Application.Current.Resources["PhoneForegroundBrush"];
                ((Shape)rectangle1).Fill = ((Brush)solidColorBrush1);
                double num4 = 0.1;
                ((UIElement)rectangle1).Opacity = num4;
                Rectangle rectangle2 = rectangle1;
                ((PresentationFrameworkCollection <UIElement>)((Panel)grid).Children).Add((UIElement)rectangle2);
                Border          border1          = new Border();
                SolidColorBrush solidColorBrush2 = new SolidColorBrush(Colors.Transparent);
                border1.Background = ((Brush)solidColorBrush2);
                Border border2 = border1;
                MetroInMotion.SetTilt((DependencyObject)border2, 1.5);
                TextBlock textBlock1 = new TextBlock();
                Thickness thickness3 = new Thickness(0.0, 12.0, 0.0, 0.0);
                ((FrameworkElement)textBlock1).Margin = thickness3;
                int num5 = 0;
                ((FrameworkElement)textBlock1).VerticalAlignment = ((VerticalAlignment)num5);
                FontFamily fontFamily = new FontFamily("Segoe WP Semibold");
                textBlock1.FontFamily = fontFamily;
                double num6 = 21.33;
                textBlock1.FontSize = num6;
                SolidColorBrush solidColorBrush3 = (SolidColorBrush)Application.Current.Resources["PhoneAccentBlueBrush"];
                textBlock1.Foreground = ((Brush)solidColorBrush3);
                int num7 = 0;
                textBlock1.TextAlignment = ((TextAlignment)num7);
                string title = this._button.title;
                textBlock1.Text = title;
                TextBlock textBlock2 = textBlock1;
                border2.Child = ((UIElement)textBlock2);
                ((PresentationFrameworkCollection <UIElement>)((Panel)grid).Children).Add((UIElement)border2);
                EventHandler <System.Windows.Input.GestureEventArgs> eventHandler2 = eventHandler1;
                ((UIElement)grid).Tap += (eventHandler2);
                return((FrameworkElement)grid);
            }
            Style     style1    = (Style)Application.Current.Resources[this._button.style == UserNotificationButtonStyle.primary ? "VKButtonPrimaryStyle" : "VKButtonSecondaryStyle"];
            Button    button    = new Button();
            Thickness thickness = new Thickness(marginLeft - 12.0, marginTop - 12.0, -12.0, -12.0);

            ((FrameworkElement)button).Margin = thickness;
            double num8 = 68.0;

            ((FrameworkElement)button).Height = num8;
            double num9 = maxWidth + 24.0;

            ((FrameworkElement)button).MaxWidth = num9;
            Style style2 = style1;

            ((FrameworkElement)button).Style = style2;
            string title1 = this._button.title;

            ((ContentControl)button).Content = title1;
            EventHandler <System.Windows.Input.GestureEventArgs> eventHandler3 = eventHandler1;

            ((UIElement)button).Tap += (eventHandler3);
            return((FrameworkElement)button);
        }
        protected override void GenerateChildren()
        {
            base.GenerateChildren();
            Rectangle rectangle1 = new Rectangle();
            double    num1       = 1.0;

            ((FrameworkElement)rectangle1).Height = num1;
            int num2 = 0;

            ((FrameworkElement)rectangle1).VerticalAlignment = ((VerticalAlignment)num2);
            double num3 = 0.1;

            ((UIElement)rectangle1).Opacity = num3;
            SolidColorBrush solidColorBrush1 = Application.Current.Resources["PhoneForegroundBrush"] as SolidColorBrush;

            ((Shape)rectangle1).Fill = ((Brush)solidColorBrush1);
            Rectangle rectangle2 = rectangle1;
            TextBlock textBlock1 = new TextBlock();
            Thickness thickness  = new Thickness(0.0, 13.0, 0.0, 0.0);

            ((FrameworkElement)textBlock1).Margin = thickness;
            int num4 = 0;

            ((FrameworkElement)textBlock1).VerticalAlignment = ((VerticalAlignment)num4);
            int num5 = 1;

            ((FrameworkElement)textBlock1).HorizontalAlignment = ((HorizontalAlignment)num5);
            SolidColorBrush solidColorBrush2 = Application.Current.Resources["PhoneBlue300_GrayBlue100Brush"] as SolidColorBrush;

            textBlock1.Foreground = ((Brush)solidColorBrush2);
            string openStickerPack = CommonResources.OpenStickerPack;

            textBlock1.Text = openStickerPack;
            TextBlock       textBlock2       = textBlock1;
            Border          border1          = new Border();
            SolidColorBrush solidColorBrush3 = new SolidColorBrush(Colors.Transparent);

            border1.Background = ((Brush)solidColorBrush3);
            TextBlock textBlock3 = textBlock2;

            border1.Child = ((UIElement)textBlock3);
            Border border2 = border1;

            MetroInMotion.SetTilt((DependencyObject)border2, 1.5);
            Grid   grid  = new Grid();
            double width = this.Width;

            ((FrameworkElement)grid).Width = width;
            double fixedHeight = this.FixedHeight;

            ((FrameworkElement)grid).Height = fixedHeight;
            SolidColorBrush solidColorBrush4 = new SolidColorBrush(Colors.Transparent);

            ((Panel)grid).Background          = ((Brush)solidColorBrush4);
            this._container                   = grid;
            ((UIElement)this._container).Tap += ((EventHandler <System.Windows.Input.GestureEventArgs>)((sender, args) =>
            {
                if (this._stickersProductId == 0L)
                {
                    return;
                }
                EventAggregator.Current.Publish(new StickersTapEvent(this._stickersProductId, 0));
            }));
            ((PresentationFrameworkCollection <UIElement>)((Panel)this._container).Children).Add((UIElement)border2);
            ((PresentationFrameworkCollection <UIElement>)((Panel)this._container).Children).Add((UIElement)rectangle2);
            this.Children.Add((FrameworkElement)this._container);
        }
Example #20
0
        private void PrepareLikesAndReplyView()
        {
            if (this._isNotificationComment || this._preview)
            {
                return;
            }
            ImageBrush imageBrush1 = new ImageBrush();
            ImageBrush imageBrush2 = new ImageBrush();

            ImageLoader.SetImageBrushMultiResSource(imageBrush1, "/Resources/Reply24px.png");
            ImageLoader.SetImageBrushMultiResSource(imageBrush2, "/Resources/Like24px.png");
            Border          border1          = new Border();
            SolidColorBrush solidColorBrush1 = (SolidColorBrush)Application.Current.Resources["PhoneGreyIconBrush"];

            border1.Background = ((Brush)solidColorBrush1);
            Thickness thickness1 = new Thickness(16.0, 12.0, 16.0, 12.0);

            ((FrameworkElement)border1).Margin = thickness1;
            ImageBrush imageBrush3 = imageBrush1;

            ((UIElement)border1).OpacityMask = ((Brush)imageBrush3);
            double num1 = 24.0;

            ((FrameworkElement)border1).Height = num1;
            double num2 = 24.0;

            ((FrameworkElement)border1).Width = num2;
            Border    border2    = border1;
            Border    border3    = new Border();
            Thickness thickness2 = new Thickness(16.0, 12.0, 16.0, 12.0);

            ((FrameworkElement)border3).Margin = thickness2;
            ImageBrush imageBrush4 = imageBrush2;

            ((UIElement)border3).OpacityMask = ((Brush)imageBrush4);
            double num3 = 24.0;

            ((FrameworkElement)border3).Height = num3;
            double num4 = 24.0;

            ((FrameworkElement)border3).Width = num4;
            this._likesIcon = border3;
            TextBlock textBlock  = new TextBlock();
            Thickness thickness3 = new Thickness(-10.0, 9.0, 16.0, 0.0);

            ((FrameworkElement)textBlock).Margin = thickness3;
            this._likesBlock = textBlock;
            Grid            grid1            = new Grid();
            SolidColorBrush solidColorBrush2 = new SolidColorBrush(Colors.Transparent);

            ((Panel)grid1).Background = ((Brush)solidColorBrush2);
            Grid grid2 = grid1;

            MetroInMotion.SetTilt((DependencyObject)grid2, 2.5);
            ((PresentationFrameworkCollection <UIElement>)((Panel)grid2).Children).Add((UIElement)border2);
            StackPanel stackPanel1 = new StackPanel();
            int        num5        = 1;

            stackPanel1.Orientation = ((Orientation)num5);
            SolidColorBrush solidColorBrush3 = new SolidColorBrush(Colors.Transparent);

            ((Panel)stackPanel1).Background = ((Brush)solidColorBrush3);
            StackPanel stackPanel2 = stackPanel1;

            MetroInMotion.SetTilt((DependencyObject)stackPanel2, 2.5);
            ((PresentationFrameworkCollection <UIElement>)((Panel)stackPanel2).Children).Add((UIElement)this._likesIcon);
            ((PresentationFrameworkCollection <UIElement>)((Panel)stackPanel2).Children).Add((UIElement)this._likesBlock);
            StackPanel stackPanel3 = new StackPanel();
            int        num6        = 1;

            stackPanel3.Orientation = ((Orientation)num6);
            SolidColorBrush solidColorBrush4 = new SolidColorBrush(Colors.Transparent);

            ((Panel)stackPanel3).Background = ((Brush)solidColorBrush4);
            this._replyAndLikesContainer    = stackPanel3;
            if (this._replyCommentCallback != null)
            {
                ((PresentationFrameworkCollection <UIElement>)((Panel)this._replyAndLikesContainer).Children).Add((UIElement)grid2);
            }
            ((PresentationFrameworkCollection <UIElement>)((Panel)this._replyAndLikesContainer).Children).Add((UIElement)stackPanel2);
            this.Children.Add((FrameworkElement)this._replyAndLikesContainer);
            this.UpdateLikesIndicator();
            ((UIElement)grid2).Tap += ((EventHandler <System.Windows.Input.GestureEventArgs>)((o, e) =>
            {
                e.Handled = true;
                this._replyCommentCallback(this);
            }));
            ((UIElement)stackPanel2).Tap += ((EventHandler <System.Windows.Input.GestureEventArgs>)((o, e) =>
            {
                e.Handled = true;
                this.Like(this._comment.likes.user_likes == 0);
            }));
        }
        public override void Initialize(Link link, double width, string parentPostId = "")
        {
            this._link = link;
            LinkProduct product = link.product;
            string      str1;

            if (product == null)
            {
                str1 = null;
            }
            else
            {
                Price price = product.price;
                str1 = price != null ? price.text :  null;
            }
            bool   hasProduct = !string.IsNullOrEmpty(str1);
            bool   hasRating  = link.rating != null;
            double val2       = this.titleBlock.LineHeight * 3.0;

            this.ComposeContentTextInlines(link, hasProduct, hasRating);
            ((FrameworkElement)this.titleBlock).MaxHeight = (this.titleBlock.LineHeight * (hasProduct || hasRating ? 2.0 : 3.0));
            if (((FrameworkElement)this.titleBlock).ActualHeight < ((FrameworkElement)this.titleBlock).MaxHeight)
            {
                ((FrameworkElement)this.descriptionBlock).MaxHeight = (((FrameworkElement)this.titleBlock).MaxHeight - ((FrameworkElement)this.titleBlock).ActualHeight);
            }
            else
            {
                ((UIElement)this.descriptionBlock).Visibility = Visibility.Collapsed;
            }
            if (hasRating)
            {
                ((UIElement)this.productContainer).Visibility = Visibility.Visible;
                if (hasProduct)
                {
                    ((UIElement)this.ratingPriceBlock).Visibility = Visibility.Visible;
                    this.ratingPriceBlock.Text = link.product.price.text;
                }
                ((UIElement)this.ratingUC).Visibility = Visibility.Visible;
                this.ratingUC.Value = link.rating.stars;
                long reviewsCount = link.rating.reviews_count;
                if (reviewsCount > 0L)
                {
                    ((UIElement)this.votesCountBlock).Visibility = Visibility.Visible;
                    this.votesCountBlock.Text = (string.Format("({0})", UIStringFormatterHelper.FormatForUIVeryShort(reviewsCount)));
                }
            }
            if (!string.IsNullOrEmpty(link.caption) && !hasProduct | hasRating)
            {
                ((UIElement)this.captionBlock).Visibility = Visibility.Visible;
                this.captionBlock.Text = link.caption;
                ((FrameworkElement)this.captionBlock).Height = (((FrameworkElement)this.captionBlock).ActualHeight);
                this._actualHeight = this._actualHeight + this.GetElementTotalHeight((FrameworkElement)this.captionBlock);
            }
            LinkButton linkButton1 = link.button;

            if (linkButton1 == null & hasProduct)
            {
                Link       link1       = link;
                LinkButton linkButton2 = new LinkButton();
                linkButton2.title = CommonResources.View;
                string str2 = string.Format("https://vk.com/product{0}_{1}", link.product.owner_id, link.product.id);
                linkButton2.url = str2;
                LinkButton linkButton3 = linkButton2;
                link1.button = linkButton2;
                linkButton1  = linkButton3;
            }
            if (link.money_transfer != null || !string.IsNullOrWhiteSpace(linkButton1 != null ? linkButton1.title :  null))
            {
                ((UIElement)this.actionButton).Visibility = Visibility.Visible;
                if (link.money_transfer == null)
                {
                    ((ContentControl)this.actionButton).Content = linkButton1.title;
                }
                else
                {
                    ((ContentControl)this.actionButton).Content = (this.CanShowCard ? CommonResources.Open : CommonResources.AboutService);
                }
                this._actualHeight = this._actualHeight + this.GetElementTotalHeight((FrameworkElement)this.actionButton);
            }
            this._actualHeight = this._actualHeight + Math.Min(((FrameworkElement)this.titleBlock).ActualHeight + ((FrameworkElement)this.priceBlock).ActualHeight + ((FrameworkElement)this.descriptionBlock).ActualHeight + ((FrameworkElement)this.ratingPriceBlock).ActualHeight, val2);
            this._actualHeight = Math.Min(this._actualHeight, 156.0);
            this._actualHeight = Math.Max(this._actualHeight, 112.0);
            double    actualHeight = this._actualHeight;
            Thickness margin       = ((FrameworkElement)this.textContainer).Margin;
            // ISSUE: explicit reference operation
            double top = ((Thickness)@margin).Top;

            margin = ((FrameworkElement)this.textContainer).Margin;
            // ISSUE: explicit reference operation
            double bottom = ((Thickness)@margin).Bottom;
            double num    = top + bottom;

            this._actualHeight = actualHeight + num;
            ((FrameworkElement)this.imageContainer).Height = this._actualHeight;
            this._imageUrl = this._link.money_transfer != null ? "/Resources/MoneyTransfers/Snippet.png" : link.photo.GetAppropriateForScaleFactor(this._actualHeight, 1);
            if (string.IsNullOrEmpty(this._link.url) || MetroInMotion.GetTilt((DependencyObject)this.LayoutRoot) == 1.2)
            {
                return;
            }
            MetroInMotion.SetTilt((DependencyObject)this.LayoutRoot, 1.2);
        }