コード例 #1
0
        private void ColorPickProviderCallback(ProviderCallbackType providerCallbackType, string message)
        {
            switch (providerCallbackType)
            {
            case ProviderCallbackType.ShowControl:
                ShowControl = _colorPickProvider.ShowControl;
                _providerCallback.Invoke(ProviderCallbackType.ShowControl, string.Empty);
                break;

            case ProviderCallbackType.End:
                if (_colorPickProvider.Result)
                {
                    var color = _colorPickProvider.ResultColor;
                    _gradientModel = GetGradientModel(_gradientPickView);
                    _gradientModel.ChangeColor(_gradientId, color);
                }

                _gradientPickView = new GradientPickView(_gradientModel, GradientPickCallback);
                ShowControl       = _gradientPickView;
                _providerCallback.Invoke(ProviderCallbackType.ShowControl, string.Empty);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(providerCallbackType), providerCallbackType, null);
            }
        }
コード例 #2
0
        private void ActionCallback(Color color)
        {
            if (_selectedColorId >= 0)
            {
                var e = _ellipses[_selectedColorId];
                e.Fill = new SolidColorBrush(color);
                switch (_colorMode)
                {
                case 2:
                    GradientModel.Add(_selectedColorId, color, _newPosition);
                    break;

                case 1:
                    GradientModel.ChangeColor(_selectedColorId, color);
                    break;
                }
            }
            else
            {
                switch (_selectedColorId)
                {
                case -11:
                    ColorLeft = new SolidColorBrush(color);
                    break;

                case -22:
                    ColorRight = new SolidColorBrush(color);
                    break;
                }
            }

            RedrawGradient();
        }