src/FingersDance.Control.Player/UserControlPlayer.xaml.cs
author riley
Fri, 31 Jul 2009 19:19:23 +0200
changeset 5 b18627685565
parent 3 4f1ea403073d
child 10 e8bfe1102e03
permissions -rw-r--r--
Mise a jour du user control panel

using System;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.ComponentModel;

namespace FingersDance.Control.Player
{
	public partial class UserControlPlayer
	{

        private bool play;

		public UserControlPlayer()
		{
			this.InitializeComponent();
             
            initPlayer();
		}

        void initPlayer()
        { 
            //init player
            play = false;
            //MediaElementVideo.Source = new Uri("Resources\\Lake.wmv", UriKind.Relative);
            MediaElementVideo.LoadedBehavior = MediaState.Manual;
        }

        private void ButtonPlayPause_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
        {
            if (!play)//Play
            {
                play = true;
                try
                {
                    MediaElementVideo.Play();
                }
                catch (Exception ex) { }
            }
            else//Pause
            {
                play = false;
                try
                {
                    MediaElementVideo.Pause();
                }
                catch (Exception exx ) { }
            }

        }

        private void ButtonPlayPause_Click(object sender, RoutedEventArgs e)
        {
            if (!play)//Play
            {
                play = true;
                try
                {
                    MediaElementVideo.Play();
                }
                catch (Exception ex ) { }
                ButtonPlayPause.Background = FindResource("[Skin_1]_Pause_button_xaml") as Brush;
            }
            else//Pause
            {
                play = false;
                try
                {
                    MediaElementVideo.Pause();
                }
                catch (Exception exx ) { }
                ButtonPlayPause.Background = FindResource("[Skin_1]_Play_button_xaml") as Brush;
            }
        }
	}
}