private void ColorPickProviderCallback(ProviderCallbackType callbackType, string message)
        {
            switch (callbackType)
            {
            case ProviderCallbackType.ShowControl:
                TopContent = _currentColorPickProvider.ShowControl;
                return;

            case ProviderCallbackType.ShowSpinner:
                TopContent = StaticClasses.GetSpinner(message);
                return;

            case ProviderCallbackType.End:
                TopContent = null;
                if (!_currentColorPickProvider.Result)
                {
                    _currentColorPickProvider = null;
                    return;
                }

                if (_currentSelectedColorIndex == -1)
                {
                    SetBackColor(_currentColorPickProvider.ResultColor);
                }
                else if (_currentSelectedColorIndex == -2)
                {
                    var resultColor = _currentColorPickProvider.ResultColor;
                    _postModel.GradientModel.ChangeColor(1, resultColor);
                    _currentColorPickProvider    = null;
                    _currentGradientPickProvider =
                        new GradientPickProvider(GradientPickProviderCallback, _postModel.GradientModel);
                    _currentGradientPickProvider.Exec();
                }
                else
                {
                    SetColor(_currentColorPickProvider.ResultColor);
                }

                _currentColorPickProvider = null;
                ShowRender();
                return;

            default:
                throw new ArgumentOutOfRangeException(nameof(callbackType), callbackType, null);
            }
        }
        private void RectangleMouseDown(object sender, MouseButtonEventArgs e)
        {
            var rectangle = (Rectangle)sender;

            _currentSelectedColorIndex = ColorRectangles.IndexOf(rectangle);

            if (RadioColor)
            {
                var color = _currentLoaderSaverProvider.Flame.FunctionColors[_currentSelectedColorIndex];
                _currentColorPickProvider = new ColorPickProvider(ColorPickProviderCallback, color);
                _currentColorPickProvider.Exec();
            }

            else if (RadioGradient)
            {
                var color = _currentLoaderSaverProvider.Flame.GradientPack.Values[_currentSelectedColorIndex];
                _currentGradientPickProvider =
                    new GradientPickProvider(GradientPickProviderCallback, _postModel.GradientModel, color);
                _currentGradientPickProvider.Exec();
            }
        }
 private void SetGradientHandler(object obj)
 {
     _currentGradientPickProvider =
         new GradientPickProvider(GradientPickProviderCallback, _postModel.GradientModel);
     _currentGradientPickProvider.Exec();
 }