using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;
using System.Windows.Media.Effects;
using System.Windows.Controls;
using System.Media;

namespace WPFApplication
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            Window win = new Window();
            win.Title = "Hello world";  

            win.Height = 383;
            win.Width = 480;

            // change background color
            win.Background = new LinearGradientBrush(Colors.LightSeaGreen, Colors.Yellow, 45.0);

            // add an eventHandler to be run on window initialization
            win.Initialized += new EventHandler(w_Initialized);

            win.AddHandler(Control.MouseLeftButtonDownEvent, new RoutedEventHandler(OnClick));

            Application app = new Application();
            app.Run(win);

        }

        static void OnClick(object sender, RoutedEventArgs e)
        {
            if (e.Source is Ellipse)
            {
                SoundPlayer sp = new
                SoundPlayer(@"c:\windows\media\tada.wav");
                sp.Play();
            }
        }   

        static void w_Initialized(object window, EventArgs e)
        {
            Ellipse ellipse = new Ellipse();

            // add new eventsHandler to interact with the mouse
            ellipse.MouseEnter += new System.Windows.Input.MouseEventHandler(ellipse_MouseEnter);
            ellipse.MouseLeave += new System.Windows.Input.MouseEventHandler(ellipse_MouseLeave);
            
            ellipse.Width = 100;
            ellipse.Stroke = Brushes.Red;
            ellipse.StrokeThickness = 1;

            ImageBrush brush = new ImageBrush();
            ImageSourceConverter imageSourceConverter = new ImageSourceConverter();
            brush.ImageSource = (ImageSource) imageSourceConverter.ConvertFrom(@"c:\paper.jpg");
            ellipse.Fill = brush;

            ((Window)window).Content = ellipse;

        }

        static void ellipse_MouseEnter(object sender, EventArgs e) {
            Ellipse ellipse = (Ellipse)sender;
            OuterGlowBitmapEffect effect = new OuterGlowBitmapEffect();
            effect.GlowColor = Colors.DeepPink;
            effect.GlowSize = 10;
            ellipse.BitmapEffect = effect;
        }
        static void ellipse_MouseLeave(object sender, EventArgs e)
        {
            Ellipse ellipse = (Ellipse)sender;
            ellipse.BitmapEffect = null;
        }
    }
}