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 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; } }
private void ReactMouseColumn(double y) { if (y < 0) { y = 0; } if (y > _canvasColumn.ActualHeight) { y = _canvasColumn.ActualHeight; } var columnY = y / _canvasColumn.ActualHeight; if (Math.Abs(_columnY - columnY) < 1E-10) { return; } _columnY = y / _canvasColumn.ActualHeight; SetIndicatorArrows(); ColorCube = ColorPickerCubeModel.Get(_colorMode, _columnY, (int)_canvasCube.ActualWidth); ColorNew.Color = ColorPickerColorsModel.GetColor(_cubeXy, _columnY, _colorMode); SetText(ColorNew.Color); }