// Ouverture de la vidéo private void ME_VideoSon_MediaOpened(object sender, System.Windows.RoutedEventArgs e) { LBL_Message.Visibility = Visibility.Collapsed; ME_VideoSon.Play(); BTN_Play.Visibility = Visibility.Collapsed; BTN_Pause.Visibility = Visibility.Visible; // Timer permettant d'actualiser le timing timer.Interval = new TimeSpan(0, 0, 1); timer.Tick += new System.EventHandler(timer_Tick); timer.Start(); // Indiquer le temps maximum de la vidéo aux scrollbars SCR_Temps.Maximum = ME_VideoSon.NaturalDuration.TimeSpan.TotalSeconds; SCR_ChangerTemps.Maximum = ME_VideoSon.NaturalDuration.TimeSpan.TotalSeconds; // Afficher un 0 si minutes < 0 ou secondes < 0 pour le temps string minutes, secondes; secondes = ME_VideoSon.NaturalDuration.TimeSpan.Seconds.ToString("00"); minutes = ME_VideoSon.NaturalDuration.TimeSpan.Minutes.ToString("00"); LBL_TempsTotal.Text = minutes + ":" + secondes; // Evènements ME_VideoSon.DownloadProgressChanged += new System.Windows.RoutedEventHandler(ME_VideoSon_DownloadProgressChanged); LayoutRoot.MouseMove += new System.Windows.Input.MouseEventHandler(LayoutRoot_MouseMove); SCR_Temps.MouseEnter += new System.Windows.Input.MouseEventHandler(SCR_Temps_MouseEnter); BTN_Play.Click += new System.Windows.RoutedEventHandler(BTN_Play_Click); BTN_Pause.Click += new System.Windows.RoutedEventHandler(BTN_Pause_Click); }
private void BTN_Pause_Click(object sender, System.Windows.RoutedEventArgs e) { ME_VideoSon.Pause(); BTN_Play.Visibility = Visibility.Visible; BTN_Pause.Visibility = Visibility.Collapsed; timer.Stop(); }
private void BTN_Play_Click(object sender, System.Windows.RoutedEventArgs e) { ME_VideoSon.Play(); BTN_Play.Visibility = Visibility.Collapsed; BTN_Pause.Visibility = Visibility.Visible; timer.Interval = new TimeSpan(0, 0, 1); timer.Tick += new System.EventHandler(timer_Tick); timer.Start(); }
private void BTN_OK_Click(object sender, RoutedEventArgs e) // Clic Bouton Ok { if (CB_Medias.SelectedItem != null) // Voir si un élément est sélectionné { ME_VideoSon.Stop(); // Stopper le média actuel // Charger le nouveau média ComboBoxItem wItem = (ComboBoxItem)CB_Medias.SelectedItem; ChargerMedia(wItem.Content.ToString()); LBL_Message.Visibility = Visibility.Visible; LBL_Message.Text = "Ouverture du média..."; ME_VideoSon.MediaOpened += new System.Windows.RoutedEventHandler(ME_VideoSon_MediaOpened); ME_VideoSon.MediaFailed += new System.EventHandler <System.Windows.ExceptionRoutedEventArgs>(ME_VideoSon_MediaFailed); RECT_Bas.Width = 0; while (RECT_Bas.Width < LayoutRoot.Width) { RECT_Bas.Width++; } } }