private void CreateFirstLinePanel()
        {
            double num          = 0.0;
            Border postTypeIcon = this.GetPostTypeIcon();

            if (postTypeIcon != null)
            {
                num += UserOrGroupHeaderItem.GetElementTotalWidth((FrameworkElement)postTypeIcon);
            }
            TextBlock textName = new TextBlock()
            {
                Text       = this._isGroupPost ? this._group.name : this._user.Name,
                FontSize   = 25.3,
                Foreground = (Brush)(Application.Current.Resources["PhoneDarkBlueBrush"] as SolidColorBrush)
            };
            double maxWidth = this.Width - (92.0 + (this._moreOptionsTapCallback != null ? 68.0 : 16.0) + num);

            textName.CorrectText(maxWidth);
            Canvas.SetLeft((UIElement)textName, 92.0);
            Canvas.SetTop((UIElement)textName, 17.0);
            this.Children.Add((FrameworkElement)textName);
            if (postTypeIcon == null)
            {
                return;
            }
            Canvas.SetLeft((UIElement)postTypeIcon, 92.0 + textName.ActualWidth);
            Canvas.SetTop((UIElement)postTypeIcon, 17.0);
            this.Children.Add((FrameworkElement)postTypeIcon);
        }
        private void CreateSecondLinePanel()
        {
            double num = 0.0;
            Border postSourceTypeIcon = this.GetPostSourceTypeIcon();

            if (postSourceTypeIcon != null)
            {
                num += UserOrGroupHeaderItem.GetElementTotalWidth((FrameworkElement)postSourceTypeIcon);
            }
            string    subtitleText = this.GetSubtitleText();
            TextBlock textBlock    = new TextBlock();

            textBlock.Text                 = subtitleText;
            textBlock.FontSize             = 20.0;
            textBlock.LineStackingStrategy = LineStackingStrategy.BlockLineHeight;
            textBlock.LineHeight           = 26.0;
            SolidColorBrush solidColorBrush = Application.Current.Resources["PhoneCaptionGrayBrush"] as SolidColorBrush;

            textBlock.Foreground = (Brush)solidColorBrush;
            TextBlock textName = textBlock;
            double    maxWidth = this.Width - (92.0 + (this._moreOptionsTapCallback != null ? 68.0 : 16.0) + num);

            textName.CorrectText(maxWidth);
            Canvas.SetLeft((UIElement)textName, 92.0);
            Canvas.SetTop((UIElement)textName, 48.0);
            this.Children.Add((FrameworkElement)textName);
            if (postSourceTypeIcon == null)
            {
                return;
            }
            Canvas.SetLeft((UIElement)postSourceTypeIcon, 92.0 + textName.ActualWidth);
            Canvas.SetTop((UIElement)postSourceTypeIcon, 48.0);
            this.Children.Add((FrameworkElement)postSourceTypeIcon);
        }
Example #3
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);
 }
Example #4
0
        private void TextBlock_OnSizeChanged(object sender, SizeChangedEventArgs e)
        {
            TextBlock textName = (TextBlock)sender;
            OutboundAttachmentBase dataContext = ((FrameworkElement)textName).DataContext as OutboundAttachmentBase;

            if (dataContext == null)
            {
                return;
            }
            textName.CorrectText(dataContext.Width - 8.0);
        }
Example #5
0
        private static void OnTextChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            TextBlock textName = (TextBlock)o;
            // ISSUE: explicit reference operation
            string newValue = (string)e.NewValue;

            textName.Text = newValue;
            double maxWidth = ((FrameworkElement)textName).MaxWidth;

            textName.CorrectText(maxWidth);
        }
Example #6
0
        protected override void GenerateChildren()
        {
            if (string.IsNullOrEmpty(this._imageSrc))
            {
                Ellipse ellipse1 = new Ellipse();
                double  num1     = 56.0;
                ((FrameworkElement)ellipse1).Width = num1;
                double num2 = 56.0;
                ((FrameworkElement)ellipse1).Height = num2;
                SolidColorBrush solidColorBrush1 = (SolidColorBrush)Application.Current.Resources["PhoneAttachIconBackgroundBrush"];
                ((Shape)ellipse1).Fill = ((Brush)solidColorBrush1);
                Ellipse ellipse2 = ellipse1;
                Canvas.SetTop((UIElement)ellipse2, 8.0);
                Canvas.SetLeft((UIElement)ellipse2, 16.0);
                this.Children.Add((FrameworkElement)ellipse2);
                Border border1 = new Border();
                double num3    = 32.0;
                ((FrameworkElement)border1).Width = num3;
                double num4 = 32.0;
                ((FrameworkElement)border1).Height = num4;
                SolidColorBrush solidColorBrush2 = (SolidColorBrush)Application.Current.Resources["PhoneGenericAttachmentIconBrush"];
                border1.Background = ((Brush)solidColorBrush2);
                Border     border2    = border1;
                ImageBrush imageBrush = new ImageBrush();
                ImageLoader.SetImageBrushMultiResSource(imageBrush, this._iconSrc);
                ((UIElement)border2).OpacityMask = ((Brush)imageBrush);
                Canvas.SetTop((UIElement)border2, 20.0);
                Canvas.SetLeft((UIElement)border2, 28.0);
                this.Children.Add((FrameworkElement)border2);
            }
            else
            {
                Rectangle rectangle1 = new Rectangle();
                double    num1       = 56.0;
                ((FrameworkElement)rectangle1).Width = num1;
                double num2 = 56.0;
                ((FrameworkElement)rectangle1).Height = num2;
                SolidColorBrush solidColorBrush = (SolidColorBrush)Application.Current.Resources["PhoneAttachIconBackgroundBrush"];
                ((Shape)rectangle1).Fill = ((Brush)solidColorBrush);
                Rectangle rectangle2 = rectangle1;
                Canvas.SetTop((UIElement)rectangle2, 8.0);
                Canvas.SetLeft((UIElement)rectangle2, 16.0);
                this.Children.Add((FrameworkElement)rectangle2);
                Image  image1 = new Image();
                double num3   = 56.0;
                ((FrameworkElement)image1).Width = num3;
                double num4 = 56.0;
                ((FrameworkElement)image1).Height = num4;
                Image image2 = image1;
                ImageLoader.SetUriSource(image2, this._imageSrc);
                Canvas.SetTop((UIElement)image2, 8.0);
                Canvas.SetLeft((UIElement)image2, 16.0);
                this.Children.Add((FrameworkElement)image2);
            }
            TextBlock       textBlock1       = new TextBlock();
            SolidColorBrush solidColorBrush3 = (SolidColorBrush)Application.Current.Resources["PhoneAlmostBlackBrush"];

            textBlock1.Foreground = ((Brush)solidColorBrush3);
            double num = 22.7;

            textBlock1.FontSize = num;
            string title = this._title;

            textBlock1.Text = title;
            TextBlock textName1 = textBlock1;

            Canvas.SetTop((UIElement)textName1, 8.0);
            Canvas.SetLeft((UIElement)textName1, 84.0);
            double maxWidth1 = this.Width - (Canvas.GetLeft((UIElement)textName1) + 16.0);

            textName1.CorrectText(maxWidth1);
            this.Children.Add((FrameworkElement)textName1);
            TextBlock       textBlock2       = new TextBlock();
            SolidColorBrush solidColorBrush4 = (SolidColorBrush)Application.Current.Resources["PhoneCaptionGrayBrush"];

            textBlock2.Foreground = ((Brush)solidColorBrush4);
            string subtitle = this._subtitle;

            textBlock2.Text = subtitle;
            TextBlock textName2 = textBlock2;

            Canvas.SetTop((UIElement)textName2, 34.0);
            Canvas.SetLeft((UIElement)textName2, 84.0);
            double maxWidth2 = this.Width - (Canvas.GetLeft((UIElement)textName2) + 16.0);

            textName2.CorrectText(maxWidth2);
            this.Children.Add((FrameworkElement)textName2);
        }