private void btnStop_Click(object sender, RoutedEventArgs e) { MediaEL.Stop(); btnPlay.Content = "Play"; IsPlaying(false); btnPlay.IsEnabled = true; }
private void Stop_Button_Click(object sender, RoutedEventArgs e) { MediaEL.Stop(); Play_Button.Content = "Play"; IsPlaying(false); Play_Button.IsEnabled = true; }
private void btnStop_Click(object sender, RoutedEventArgs e) { MediaEL.Stop(); btnPlay.Content = playButtonImageList[1]; IsPlaying(false); btnPlay.IsEnabled = true; //直接關掉 this.Close(); }
private void InitialPlay() { IsPlaying(true); if (btnPlay.Content.ToString() == "Play") { MediaEL.Play(); btnPlay.Content = "Pause"; } else { MediaEL.Pause(); btnPlay.Content = "Play"; } }
private void btnPlay_Click(object sender, RoutedEventArgs e) { IsPlaying(true); if (btnPlay.Content.ToString() == "Play") { MediaEL.Play(); btnPlay.Content = "Pause"; } else { MediaEL.Pause(); btnPlay.Content = "Play"; } }
public void btnPlay_Click(object sender, RoutedEventArgs e) { // VideoToFrames.ReadFromVideo(); IsPlaying(true); if (btnPlay.Content.ToString() == "Play") { MediaEL.Play(); btnPlay.Content = "Pause"; } else { MediaEL.Pause(); btnPlay.Content = "Play"; } }
private void btnPlay_Click(object sender, RoutedEventArgs e) { IsPlaying(true); string name = ((Image)btnPlay.Content).Name; if (name.Equals("play")) { MediaEL.Play(); btnPlay.Content = playButtonImageList[0]; } else if (name.Equals("pause")) { MediaEL.Pause(); btnPlay.Content = playButtonImageList[1]; } }
private void btnScreenShot_Click(object sender, RoutedEventArgs e) { MediaEL.Pause(); btnPlay.Content = "Play"; string sMessageBoxText = "Do you want to use this screenshot?"; string sCaption = "Confirm screenshot"; MessageBoxButton btnMessageBox = MessageBoxButton.YesNo; MessageBoxImage icnMessageBox = MessageBoxImage.Question; MessageBoxResult rsltMessageBox = MessageBox.Show(sMessageBoxText, sCaption, btnMessageBox, icnMessageBox); switch (rsltMessageBox) { case MessageBoxResult.Yes: byte[] screenshot = MediaEL.GetScreenShot(1, 90); string baseURI = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string pathString = System.IO.Path.Combine(baseURI, "ScreenShots"); System.IO.Directory.CreateDirectory(pathString); using (FileStream fileStream = new FileStream(baseURI + @"\ScreenShots\Capture" + n + ".jpg", FileMode.Create, FileAccess.Write, FileShare.ReadWrite)) { BinaryWriter binaryWriter = new BinaryWriter(fileStream); binaryWriter.Write(screenshot); fileStream.Close(); } this.Visibility = Visibility.Hidden; this.IsEnabled = false; MainWindow two = new MainWindow(this, n, seekBar.Value); if (two.ShowDialog() == false) { this.Visibility = Visibility.Visible; this.IsEnabled = true; } n++; break; case MessageBoxResult.No: MediaEL.Play(); btnPlay.Content = "Pause"; break; } }
private void Open_Button_Click(object sender, RoutedEventArgs e) { System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog(); // ofd.Filter = "Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*"; ofd.Filter = "All files (*.*)|*.*"; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource; HwndTarget hwndTarget = hwndSource.CompositionTarget; hwndTarget.RenderMode = RenderMode.SoftwareOnly; base.OnSourceInitialized(e); MediaEL.Source = new Uri(ofd.FileName); Play_Button.IsEnabled = true; Stop_Button.IsEnabled = true; Full_Screen_Button.IsEnabled = true; MediaEL.Play(); //MediaEL.Position = MediaEL.Position + TimeSpan.FromMinutes(23); } }
public MoviePlayer(string FilePath, Boolean IsMovie, Boolean isToolBarEnabled) { this.filePath = FilePath; InitializeComponent(); playButtonImageList = new List <Image>() { new Image() { Name = "pause", Style = (Style)FindResource("PauseImageStyle") }, new Image() { Name = "play", Style = (Style)FindResource("PlayImageStyle") } }; IsPlaying(false); timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromMilliseconds(200); timer.Tick += new EventHandler(timer_Tick); MediaEL.Source = new Uri(FilePath); if (!IsMovie) { MediaEL.Visibility = System.Windows.Visibility.Collapsed; } if (isToolBarEnabled) { controlPanel.IsEnabled = true; } else { controlPanel.IsEnabled = false; } MediaEL.Play(); IsPlaying(true); }