private void ActRadio(string name, object state)
 {
     if (!(bool)state)
     {
         return;
     }
     _colorMode = _elementModes[name];
     ColorPickerCoordinatesModel.Get(ColorNew.Color, _colorMode, out _cubeXy, out _columnY);
     SetIndicators();
     ColorCube   = ColorPickerCubeModel.Get(_colorMode, _columnY, (int)_canvasCube.ActualWidth);
     ColorColumn = ColorPickerColumnModel.Get(_cubeXy, _colorMode, (int)_canvasColumn.ActualWidth,
                                              (int)_canvasColumn.ActualHeight);
     SetText(ColorNew.Color);
 }
        private void ReactMouseCube(Point p)
        {
            var moved = false;

            if (p.X < 0)
            {
                p.X = 0;
            }
            if (p.X > _canvasCube.ActualWidth)
            {
                p.X = _canvasCube.ActualWidth;
            }
            if (Math.Abs(p.X - _cubeXy.X) > 1E-10)
            {
                moved     = true;
                _cubeXy.X = p.X / _canvasCube.ActualWidth;
            }

            if (p.Y < 0)
            {
                p.Y = 0;
            }
            if (p.Y > _canvasCube.ActualHeight)
            {
                p.Y = _canvasCube.ActualHeight;
            }
            if (Math.Abs(p.Y - _cubeXy.Y) > 1E-10)
            {
                moved     = true;
                _cubeXy.Y = p.Y / _canvasCube.ActualHeight;
            }

            if (!moved)
            {
                return;
            }

            SetIndicatorEllipse(p);
            if (_colorMode != 0)
            {
                ColorColumn = ColorPickerColumnModel.Get(_cubeXy, _colorMode, (int)_canvasColumn.ActualWidth,
                                                         (int)_canvasColumn.ActualHeight);
            }
            ColorNew.Color = ColorPickerColorsModel.GetColor(_cubeXy, _columnY, _colorMode);
            SetText(ColorNew.Color);
        }
        private void CommandHandler(object obj)
        {
            switch ((string)obj)
            {
            case "ok":
                _canvasColumn.Children.Remove(_columnArrows);
                _callback.Invoke(true, ColorNew.Color);
                break;

            case "cancel":
                _canvasColumn.Children.Remove(_columnArrows);
                _callback.Invoke(false, ColorCurrent.Color);
                break;

            case "current":
                ColorNew = new SolidColorBrush(ColorCurrent.Color);
                ColorPickerCoordinatesModel.Get(ColorNew.Color, _colorMode, out _cubeXy, out _columnY);
                ColorCube   = ColorPickerCubeModel.Get(_colorMode, _columnY, (int)_canvasCube.ActualWidth);
                ColorColumn = ColorPickerColumnModel.Get(_cubeXy, _colorMode, (int)_canvasColumn.ActualWidth,
                                                         (int)_canvasColumn.ActualHeight);
                SetIndicators();
                break;
            }
        }