using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WPF_Kolory
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }

        private void slider1_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            try
            {
                RadialGradientBrush pedzel = ellipse1.Fill as RadialGradientBrush;
                double promien = 0.35;
                double kat = 2 * Math.PI * slider4.Value;
                pedzel.GradientOrigin = new Point(0.5 + promien * Math.Cos(kat), 0.5 + promien * Math.Sin(kat));
                pedzel.GradientStops[0].Offset = slider1.Value;
                pedzel.GradientStops[1].Offset = slider2.Value;
                pedzel.GradientStops[2].Offset = slider3.Value;
            }
            catch (NullReferenceException)
            {
                return;
            }
        }

        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Escape) this.Close();
        }       
    }
}
