using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media.Animation;

namespace McLaren_WPF.Views
{

    public partial class Shell 
    {
        public Shell()
        {
            InitializeComponent();
            MouseLeftButtonDown += Window_MouseLeftButtonDown;
        }

        private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            try { DragMove(); } catch {}
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //window animation
            var daf = new DoubleAnimation
            {
                From = 0,
                To = 1,
                Duration = new Duration(TimeSpan.FromSeconds(3)),
                AutoReverse = false
            };
            BeginAnimation(OpacityProperty, daf);

            //Button animation
            var dab = new DoubleAnimation
            {
                From = 1,
                To = 0.5,
                Duration = new Duration(TimeSpan.FromSeconds(1)),
                AutoReverse = true,
                RepeatBehavior = new RepeatBehavior(5)
            };
            LoadButton.BeginAnimation(OpacityProperty, dab);
        }
    }
}
