src/FingersDance.Control.Player/UserControlPlayer.xaml.cs
changeset 3 4f1ea403073d
child 5 b18627685565
equal deleted inserted replaced
2:06de3a61998f 3:4f1ea403073d
       
     1 using System;
       
     2 using System.IO;
       
     3 using System.Net;
       
     4 using System.Windows;
       
     5 using System.Windows.Controls;
       
     6 using System.Windows.Data;
       
     7 using System.Windows.Media;
       
     8 using System.Windows.Media.Imaging;
       
     9 using System.Windows.Media.Animation;
       
    10 using System.Windows.Navigation;
       
    11 using System.ComponentModel;
       
    12 
       
    13 namespace FingersDance.Control.Player
       
    14 {
       
    15 	public partial class UserControlPlayer
       
    16 	{
       
    17 
       
    18         private bool play;
       
    19 
       
    20 		public UserControlPlayer()
       
    21 		{
       
    22 			this.InitializeComponent();
       
    23              
       
    24             initPlayer();
       
    25 		}
       
    26 
       
    27         void initPlayer()
       
    28         { 
       
    29             //init player
       
    30             play = false;
       
    31             //MediaElementVideo.Source = new Uri("Resources\\Lake.wmv", UriKind.Relative);
       
    32             MediaElementVideo.LoadedBehavior = MediaState.Manual;
       
    33         }
       
    34 
       
    35         private void ButtonPlayPause_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
       
    36         {
       
    37             if (!play)//Play
       
    38             {
       
    39                 play = true;
       
    40                 try
       
    41                 {
       
    42                     MediaElementVideo.Play();
       
    43                 }
       
    44                 catch (Exception ex) { }
       
    45             }
       
    46             else//Pause
       
    47             {
       
    48                 play = false;
       
    49                 try
       
    50                 {
       
    51                     MediaElementVideo.Pause();
       
    52                 }
       
    53                 catch (Exception exx ) { }
       
    54             }
       
    55 
       
    56         }
       
    57 
       
    58         private void ButtonPlayPause_Click(object sender, RoutedEventArgs e)
       
    59         {
       
    60             if (!play)//Play
       
    61             {
       
    62                 play = true;
       
    63                 try
       
    64                 {
       
    65                     MediaElementVideo.Play();
       
    66                 }
       
    67                 catch (Exception ex ) { }
       
    68             }
       
    69             else//Pause
       
    70             {
       
    71                 play = false;
       
    72                 try
       
    73                 {
       
    74                     MediaElementVideo.Pause();
       
    75                 }
       
    76                 catch (Exception exx ) { }
       
    77             }
       
    78         }
       
    79 	}
       
    80 }