Esempio n. 1
0
 private void Palette_Click(object sender, RoutedEventArgs e)
 {
     if (ColorPickerWindow.ShowDialog(out ColorEnt))
     {
         color = ColorEnt;
     }
 }
Esempio n. 2
0
        public BorderControl()
        {
            InitializeComponent();

            _vm         = new BorderControlViewModel();
            DataContext = _vm;

            _vm.ColorPickCommand = new RelayCommand(o =>
            {
                ColorPickerControl.ColorPickerChangeHandler previewHandler =
                    selectedColor => RaiseEvent(new ColorSelectedEvent(TintSelectedEvent, selectedColor));

                Color color;
                bool ok = SettingsManager.LiveColorPreview
                    ? ColorPickerWindow.ShowDialog(out color, ColorPickerDialogOptions.None, null, _vm.SelectColor, previewHandler)
                    : ColorPickerWindow.ShowDialog(out color, ColorPickerDialogOptions.None, null, _vm.SelectColor);

                if (ok)
                {
                    _vm.SelectColor = color;
                }

                RaiseEvent(new ColorSelectedEvent(TintSelectedEvent, _vm.SelectColor));
            });
        }
        private void ButtonGrayColorButton_Click(object sender, RoutedEventArgs e)
        {
            ColorPickerWindow colorPicker = new ColorPickerWindow(ViewModel.PixelColor);

            if (colorPicker.ShowDialog() == true)
            {
                ViewModel.PixelColor = colorPicker.ViewModel.Color;
            }
        }
Esempio n. 4
0
        private void ChangeColorButton_Click(object sender, RoutedEventArgs e)
        {
            Color color;
            bool  ok = ColorPickerWindow.ShowDialog(out color);

            if (ok)
            {
                myApp.mainViewModel.SelectedActionButton.Color = color.ToString();
            }
        }
Esempio n. 5
0
        public void PickColorButton_OnClick(TextBox textBox)
        {
            Color color;

            if (ColorPickerWindow.ShowDialog(out color, Options))
            {
                SetColor(color, textBox);
                OnPick?.Invoke(this, EventArgs.Empty);
            }
        }
Esempio n. 6
0
        private void ChangeColorButton_Click(object sender, RoutedEventArgs e)
        {
            var  color   = this.Color;
            bool changed = ColorPickerWindow.ShowDialog(out color);

            if (changed)
            {
                this.Color     = color;
                ColorRect.Fill = new SolidColorBrush(this.Color);
            }
        }
Esempio n. 7
0
        public void ExecuteChangeColorCommand()
        {
            Color changedColor;

            if (ColorPickerWindow.ShowDialog(out changedColor))
            {
                CurrentColor = changedColor;
                Locked       = true;
                OnPropertyChanged("Locked");
            }
        }
Esempio n. 8
0
        public void ShowBackgroundColorPicker()
        {
            var currentBackgroundBrush = (SolidColorBrush)BackgroundLayer.Background;
            var currentBackgroundColor = currentBackgroundBrush == null ? Colors.Transparent : currentBackgroundBrush.Color;
            var colorDialog            = new ColorPickerWindow(currentBackgroundColor);

            if (colorDialog.ShowDialog() == true)
            {
                ChangeBackgroundColor(colorDialog.Color);
            }
        }
Esempio n. 9
0
        private void Canvas_MouseUp(object sender, MouseButtonEventArgs e)
        {
            ColorPickerWindow colorPicker = new ColorPickerWindow
            {
                SelectedColor = SelectedColor.Color
            };

            colorPicker.ShowDialog();

            SelectedColor.Color = colorPicker.SelectedColor;
            ColorStop2.Color    = SelectedColor.Color;
        }
        private void SecondaryColor_Button_Click(object sender, RoutedEventArgs e)
        {
            Color color;
            bool  ok = ColorPickerWindow.ShowDialog(out color);

            if (ok)
            {
                FProp.Default.FSecondaryColor = color.R + ":" + color.G + ":" + color.B;
                FProp.Default.Save();

                UpdateChallengeCustomTheme();
            }
        }
 private void ShowColorPickerExecute()
 {
     //Show the ColorPickerWindow
     if (_colorPicker.ShowDialog().GetValueOrDefault(false))
     {
         // Show which color is picked or do whatever you want
         MessageBox.Show(Color.ToString());
     }
     else
     {
         MessageBox.Show(Color.ToString());
     }
 }
Esempio n. 12
0
        private void bReplaceWithColor_Click(object sender, RoutedEventArgs e)
        {
            Color replacementColor;

            if (ColorPickerWindow.ShowDialog(out replacementColor))
            {
                var vm = this.ViewModel;
                if (vm == null)
                {
                    return;
                }
                vm.ReplacementColor = replacementColor;
            }
        }
Esempio n. 13
0
        private static void ColorPickerButton_Click(object sender, RoutedEventArgs e)
        {
            if (!(sender is FrameworkElement element))
            {
                throw new InvalidOperationException($"{nameof(sender)} of type {sender.GetType()} does not inherit {nameof(FrameworkElement)}.");
            }
            var propertyControl = (PropertyBoundControl <TextBox>)element.Tag;

            var displayText = propertyControl.Property.GetCustomAttribute <ShowInEditorAttribute>().DisplayText;
            var pickedColor = TryGetColorFromString(propertyControl.Control.Text, out var color)
                ? ColorPickerWindow.ShowDialog(displayText, color)
                : ColorPickerWindow.ShowDialog(displayText);

            if (pickedColor != null)
            {
                propertyControl.Control.Text = pickedColor.ToString();
            }
        }
Esempio n. 14
0
        private void ColorButton_Click(object sender, RoutedEventArgs e)
        {
            Color4 originalColor = ToColor4(PropertyInfo.Value);

            ColorPickerWindow window = new ColorPickerWindow(EditorConversionUtility.ConvertEngineColorToSystem(originalColor));

            window.PreviewColorChanged += (color) =>
            {
                SetInspectorValue(PropertyInfo, ToColor4(PropertyInfo.Value), EditorConversionUtility.ConvertSystemColorToEngine(color), false);
            };

            bool?result = window.ShowDialog();

            if (!result.HasValue || !result.Value)
            {
                SetInspectorValue(PropertyInfo, ToColor4(PropertyInfo.Value), originalColor, false);
            }
            else if (result.HasValue && result.Value)
            {
                SetInspectorValue(PropertyInfo, originalColor, ToColor4(PropertyInfo.Value), true);
            }
        }
Esempio n. 15
0
        private void ColorStroke_Click(object sender, RoutedEventArgs e)
        {
            bool cp = ColorPickerWindow.ShowDialog(out _colorStroke);

            SetColorStroke();
        }
Esempio n. 16
0
        public SpecialControl()
        {
            InitializeComponent();
            _vm         = new SpecialControlViewModel();
            DataContext = _vm;

            _vm.ColorPickCommand = new RelayCommand(o =>
            {
                ColorPickerControl.ColorPickerChangeHandler previewHandler =
                    selectedColor => RaiseEvent(new ColorSelectedEvent(TextManipulationChangedEvent, selectedColor));

                Color color;
                bool ok = SettingsManager.LiveColorPreview
                    ? ColorPickerWindow.ShowDialog(out color, ColorPickerDialogOptions.None, null, _vm.TextColor, previewHandler)
                    : ColorPickerWindow.ShowDialog(out color, ColorPickerDialogOptions.None, null, _vm.TextColor);

                if (ok)
                {
                    _vm.TextColor = color;
                }

                RaiseEvent(new ColorSelectedEvent(TextManipulationChangedEvent, _vm.TextColor));
            });

            _vm.BackdropColorPickCommand = new RelayCommand(o =>
            {
                ColorPickerControl.ColorPickerChangeHandler previewHandler =
                    selectedColor => RaiseEvent(new ColorSelectedEvent(BackdropColorChangedEvent, selectedColor));

                Color color;
                bool ok = SettingsManager.LiveColorPreview
                    ? ColorPickerWindow.ShowDialog(out color, ColorPickerDialogOptions.None, null, _vm.BackdropColor, previewHandler)
                    : ColorPickerWindow.ShowDialog(out color, ColorPickerDialogOptions.None, null, _vm.BackdropColor);

                if (ok)
                {
                    _vm.BackdropColor = color;
                }

                RaiseEvent(new ColorSelectedEvent(BackdropColorChangedEvent, _vm.BackdropColor));
            });

            _vm.SpecialFilterColorPickCommand = new RelayCommand(o =>
            {
                ColorPickerControl.ColorPickerChangeHandler previewHandler =
                    selectedColor => RaiseEvent(new ColorSelectedEvent(SpecialFilterColorChangedEvent, selectedColor));

                Color color;
                bool ok = SettingsManager.LiveColorPreview
                    ? ColorPickerWindow.ShowDialog(out color, ColorPickerDialogOptions.None, null, _vm.SpecialFilterColor, previewHandler)
                    : ColorPickerWindow.ShowDialog(out color, ColorPickerDialogOptions.None, null, _vm.SpecialFilterColor);

                if (ok)
                {
                    _vm.SpecialFilterColor = color;
                }

                RaiseEvent(new ColorSelectedEvent(SpecialFilterColorChangedEvent, _vm.SpecialFilterColor));
            });

            _vm.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == nameof(_vm.RotationAngle))
                {
                    if (int.TryParse(_vm.RotationAngle, out int rotationAngle))
                    {
                        RaiseEvent(new RotationChangedEvent(RotationChangedEvent, rotationAngle));
                    }
                }
                if (args.PropertyName == nameof(_vm.TextManipulationShowBorder) ||
                    args.PropertyName == nameof(_vm.TextManipulationShowText) ||
                    args.PropertyName == nameof(_vm.TextRotationAngle) ||
                    args.PropertyName == nameof(_vm.TextContent))
                {
                    int.TryParse(_vm.TextRotationAngle, out int textRotationAngle);

                    var textChangedEvent = new TextManipulationEvent(
                        TextManipulationChangedEvent,
                        _vm.TextManipulationShowBorder,
                        _vm.TextManipulationShowText,
                        _vm.TextContent,
                        textRotationAngle
                        );
                    RaiseEvent(textChangedEvent);
                }
            };
            _vm.ManualZoomImage = new RelayCommand(o =>
            {
                RaiseEvent(new ButtonZoomEvent(ButtonZoomEvent, int.Parse(o.ToString()), Events.ButtonZoomEvent.Target.Image));
            });
            _vm.ManualZoomText = new RelayCommand(o =>
            {
                RaiseEvent(new ButtonZoomEvent(ButtonZoomEvent, int.Parse(o.ToString()), Events.ButtonZoomEvent.Target.Text));
            });
        }