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 TrailerPlayer
{
    public partial class TrailerControl : UserControl
    {
        
        public static double ElementWidth
        {
            get
            {
                 return 350;
            }
           
        }
        public TrailerControl()
        {
            InitializeComponent();
            Loaded += new RoutedEventHandler(TrailerControl_Loaded);
        }
        void TrailerControl_Loaded(object sender, RoutedEventArgs e)
        {
            Application.Current.Host.Content.FullScreenChanged += new EventHandler(Content_FullScreenChanged);
            DataView.Width = ElementWidth;
        }

        void Content_FullScreenChanged(object sender, EventArgs e)
        {
            if (Application.Current.Host.Content.IsFullScreen == true)
            {
                Mask.Visibility = Visibility.Collapsed;
                DataView.Visibility = Visibility.Collapsed;
                this.Width = Application.Current.Host.Content.ActualWidth;
            }
            else
            {
                Mask.Visibility = Visibility.Visible;
                DataView.Visibility = Visibility.Visible;
                this.Width = ElementWidth;
             
            }
            
        }

        private void btnTrailer_Click(object sender, RoutedEventArgs e)
        {
            if (btnTrailer.IsChecked==true)
            {
                mediaplayer_in.Begin();
            }
            else
            {
                mediaplayer_out.Begin();
                MediaPlayer.Stop();
            }
        }
        private void btnDescription_Click(object sender, RoutedEventArgs e)
        {
            if (btnDescription.IsChecked == true)
            {
                description_in.Begin();
            }
            else
            {
                description_out.Begin();
            }
        }
        public void Selected()
        {
            selected.Begin();
        }
        public void Unselected()
        {
            unselected.Begin();
            mediaplayer_out.Begin();
            description_out.Begin();
            MediaPlayer.Stop();
        }
    }
}
