using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace GaugeSamples
{
    public partial class LinearGauge : UserControl
    {
        public LinearGauge()
        {
            InitializeComponent();

            //Applies a random animation to show a more lively sample.
            var r = new Random();
            var storyboard = new Storyboard();
            var animation = new DoubleAnimation();
            animation.Duration = TimeSpan.FromSeconds(1);
            animation.EasingFunction = new QuadraticEase() { EasingMode = EasingMode.EaseInOut };
            Storyboard.SetTarget(animation, myGauge);
            Storyboard.SetTargetProperty(animation, new PropertyPath("(c1Gaugeauge.Value)"));
            storyboard.Children.Add(animation);
            storyboard.Completed += (s, e) =>
            {
                animation.From = animation.To;
                animation.To = r.NextDouble() * 100;
                storyboard.Begin();
            };
            storyboard.Begin();
        }
    }
}
