using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Txgy.EWS.Client.Upgrade.Controls
{
    /// 
    /// WaterProgress.xaml 的交互逻辑
    /// 
    public partial class WaterProgress : UserControl
    {
        public double Value
        {
            get { return (double)GetValue(ValueProperty); }
            set { SetValue(ValueProperty, value); }
        }
        public static readonly DependencyProperty ValueProperty =
            DependencyProperty.Register(
                "Value",
                typeof(double),
                typeof(WaterProgress),
                new PropertyMetadata(
                    default(double),
                    new PropertyChangedCallback(OnValueChanged)
                    )
                );
        private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            // 
            double newValue = (double)e.NewValue;
            DoubleAnimation da = new DoubleAnimation(160 - newValue * 1.6, TimeSpan.FromMilliseconds(500));
            (d as WaterProgress).ttg.BeginAnimation(TranslateTransform.YProperty, da);
        }
        public WaterProgress()
        {
            InitializeComponent();
        }
    }
}