Exemple #1
0
        public static void SetBitmapImage(Image image, string fileName, bool isFullImagePath = false)
        {
            BitmapImage bitmapImage = CustomPictureBox.GetBitmapImage(fileName, "", isFullImagePath);

            if (bitmapImage != null)
            {
                bitmapImage.Freeze();
                BlueStacksUIBinding.Bind(image, Image.SourceProperty, fileName);
                if (image is CustomPictureBox)
                {
                    CustomPictureBox customPictureBox = image as CustomPictureBox;
                    customPictureBox.BitmapImage = bitmapImage;
                    if (customPictureBox.IsAlwaysHalfSize)
                    {
                        customPictureBox.maxSize   = new Point(customPictureBox.MaxWidth, customPictureBox.MaxHeight);
                        customPictureBox.MaxWidth  = bitmapImage.Width / 2.0;
                        customPictureBox.MaxHeight = bitmapImage.Height / 2.0;
                    }
                    else if (customPictureBox.maxSize != new Point())
                    {
                        customPictureBox.MaxWidth  = customPictureBox.maxSize.X;
                        customPictureBox.MaxHeight = customPictureBox.maxSize.Y;
                    }
                }
            }
        }
Exemple #2
0
        public void AddBulletInBody(string text)
        {
            Ellipse ellipse1 = new Ellipse();

            ellipse1.Width             = 9.0;
            ellipse1.Height            = 9.0;
            ellipse1.VerticalAlignment = VerticalAlignment.Center;
            Ellipse ellipse2 = ellipse1;

            BlueStacksUIBinding.BindColor((DependencyObject)ellipse2, Shape.FillProperty, "ContextMenuItemForegroundDimColor");
            TextBlock textBlock1 = new TextBlock();

            textBlock1.FontSize   = 18.0;
            textBlock1.MaxWidth   = 300.0;
            textBlock1.FontWeight = FontWeights.Regular;
            TextBlock textBlock2 = textBlock1;

            BlueStacksUIBinding.BindColor((DependencyObject)textBlock2, Control.ForegroundProperty, "ContextMenuItemForegroundDimColor");
            textBlock2.TextWrapping        = TextWrapping.Wrap;
            textBlock2.Text                = text;
            textBlock2.HorizontalAlignment = HorizontalAlignment.Left;
            textBlock2.VerticalAlignment   = VerticalAlignment.Center;
            textBlock2.Margin              = new Thickness(0.0, 0.0, 0.0, 10.0);
            BulletDecorator bulletDecorator = new BulletDecorator();

            bulletDecorator.Bullet = (UIElement)ellipse2;
            bulletDecorator.Child  = (UIElement)textBlock2;
            this.mBodyTextStackPanel.Children.Add((UIElement)bulletDecorator);
        }
 public static void BindCornerRadiusToDouble(
     DependencyObject dObj,
     DependencyProperty dp,
     string path)
 {
     BindingOperations.SetBinding(dObj, dp, (BindingBase)BlueStacksUIBinding.GetCornerRadiusDoubleBinding(path));
 }
        public static void Bind(TextBlock tb, string path, string stringFormat = "")
        {
            Binding localeBinding = BlueStacksUIBinding.GetLocaleBinding(path);

            if (!string.IsNullOrEmpty(stringFormat))
            {
                localeBinding.StringFormat = stringFormat;
            }
            BindingOperations.SetBinding((DependencyObject)tb, TextBlock.TextProperty, (BindingBase)localeBinding);
        }
 private void SetForeGround()
 {
     if (this.isSelected)
     {
         BlueStacksUIBinding.BindColor((DependencyObject)this, Control.ForegroundProperty, "SettingsWindowTabMenuItemSelectedForeground");
     }
     else
     {
         BlueStacksUIBinding.BindColor((DependencyObject)this, Control.ForegroundProperty, "SettingsWindowTabMenuItemForeground");
     }
 }
 private void SetBackground()
 {
     if (this.IsSelected)
     {
         BlueStacksUIBinding.BindColor((DependencyObject)this, Control.BackgroundProperty, "SettingsWindowTabMenuItemSelectedBackground");
     }
     else
     {
         this.Button_MouseEvent((object)null, (MouseEventArgs)null);
     }
 }
 private void Button_MouseEvent(object sender, MouseEventArgs e)
 {
     if (this.IsSelected)
     {
         return;
     }
     if (this.IsMouseOver)
     {
         BlueStacksUIBinding.BindColor((DependencyObject)this, Control.BackgroundProperty, "SettingsWindowTabMenuItemHoverBackground");
     }
     else
     {
         BlueStacksUIBinding.BindColor((DependencyObject)this, Control.BackgroundProperty, "SettingsWindowTabMenuItemBackground");
     }
 }
Exemple #8
0
 public void AddButtonInUI(
     CustomButton button,
     ButtonColors color,
     string text,
     EventHandler handle,
     string image,
     bool ChangeImageAlignment,
     object data,
     bool isEnabled)
 {
     if (button != null)
     {
         if (this.mButton1 == null)
         {
             this.mButton1 = button;
         }
         else
         {
             this.mButton2 = button;
             button.Margin = new Thickness(15.0, 0.0, 0.0, 0.0);
         }
         button.IsEnabled  = isEnabled;
         button.Click     += new RoutedEventHandler(this.Button_Click);
         button.MinWidth   = 100.0;
         button.Visibility = Visibility.Visible;
         BlueStacksUIBinding.Bind((Button)button, text);
         if (image != null)
         {
             button.ImageName   = image;
             button.ImageMargin = new Thickness(0.0, 6.0, 5.0, 6.0);
             if (ChangeImageAlignment)
             {
                 button.ImageOrder  = ButtonImageOrder.AfterText;
                 button.ImageMargin = new Thickness(5.0, 6.0, 0.0, 6.0);
             }
         }
     }
     this.mStackPanel.Children.Add((UIElement)button);
     this.mDictActions.Add((object)button, new Tuple <ButtonColors, EventHandler, object>(color, handle, data));
 }
 public static void Bind(GroupBox gb, string path)
 {
     BindingOperations.SetBinding((DependencyObject)gb, HeaderedContentControl.HeaderProperty, (BindingBase)BlueStacksUIBinding.GetLocaleBinding(path));
 }
 public static void Bind(Window wind, string path)
 {
     BindingOperations.SetBinding((DependencyObject)wind, Window.TitleProperty, (BindingBase)BlueStacksUIBinding.GetLocaleBinding(path));
 }
 public static void Bind(DependencyObject icon, string path, DependencyProperty dp)
 {
     BindingOperations.SetBinding(icon, dp, (BindingBase)BlueStacksUIBinding.GetLocaleBinding(path));
 }
 public static void Bind(ComboBoxItem comboBoxItem, string path)
 {
     BindingOperations.SetBinding((DependencyObject)comboBoxItem, ContentControl.ContentProperty, (BindingBase)BlueStacksUIBinding.GetLocaleBinding(path));
 }
 public static void Bind(Button button, string path)
 {
     BindingOperations.SetBinding((DependencyObject)button, ContentControl.ContentProperty, (BindingBase)BlueStacksUIBinding.GetLocaleBinding(path));
 }
 public static void BindTransform(DependencyObject button, DependencyProperty dp, string path)
 {
     BindingOperations.SetBinding(button, dp, (BindingBase)BlueStacksUIBinding.GetTransformBinding(path));
 }
 public static void Bind(Image button, DependencyProperty dp, string path)
 {
     BindingOperations.SetBinding((DependencyObject)button, dp, (BindingBase)BlueStacksUIBinding.GetImageBinding(path));
 }
 public static void Bind(Run run, string path)
 {
     BindingOperations.SetBinding((DependencyObject)run, TextBlock.TextProperty, (BindingBase)BlueStacksUIBinding.GetLocaleBinding(path));
 }
 public static void Bind(TextBox textBox, string path)
 {
     BindingOperations.SetBinding((DependencyObject)textBox, TextBox.TextProperty, (BindingBase)BlueStacksUIBinding.GetLocaleBinding(path));
 }
 public static void Bind(Image button, string path)
 {
     BindingOperations.SetBinding((DependencyObject)button, FrameworkElement.ToolTipProperty, (BindingBase)BlueStacksUIBinding.GetLocaleBinding(path));
 }