public void PlaySlide() { if (Slide?.MediaType == MediaType.Video && !keydisplay) { VideoDisplay.Play(); } }
public void ShowSlide(bool showkey) { keydisplay = showkey; background.Visibility = Visibility.Hidden; if (showkey) { if (Slide.KeyBitmap != null) { VideoDisplay.Visibility = Visibility.Hidden; textDisplay.Visibility = Visibility.Hidden; ImgDisplay.Visibility = Visibility.Visible; ImgDisplay.Source = Slide.KeyBitmap.ConvertToBitmapImage(); } else { VideoDisplay.Visibility = Visibility.Hidden; textDisplay.Text = "NO KEY"; // handle action slides being auto loaded with black keys if (Slide.RenderedAs == "Action") { background.Fill = Brushes.Black; background.Visibility = Visibility.Visible; textDisplay.Text = "AUTO BLACK KEY\r\n(for action)"; } textDisplay.Visibility = Visibility.Visible; ImgDisplay.Visibility = Visibility.Hidden; } } else { ImgDisplay.Source = null; VideoDisplay.Source = null; if (Slide?.MediaType == MediaType.Image) { VideoDisplay.Visibility = Visibility.Hidden; textDisplay.Visibility = Visibility.Hidden; ImgDisplay.Visibility = Visibility.Visible; ImgDisplay.Source = Slide.Bitmap.ConvertToBitmapImage(); } if (Slide?.MediaType == MediaType.Video) { ImgDisplay.Visibility = Visibility.Hidden; textDisplay.Visibility = Visibility.Hidden; VideoDisplay.Visibility = Visibility.Visible; VideoDisplay.Source = new Uri(Slide.AssetPath); VideoDisplay.MediaEnded += VideoDisplay_MediaEnded; VideoDisplay.Volume = 0; VideoDisplay.Play(); } if (Slide?.MediaType == MediaType.Audio) { VideoDisplay.Visibility = Visibility.Hidden; textDisplay.Visibility = Visibility.Visible; ImgDisplay.Visibility = Visibility.Visible; ImgDisplay.Source = new BitmapImage(new Uri("pack://application:,,,/ViewControls/Images/musicnote.png")); textDisplay.Text = Slide.Name + Slide.CopyExtension; } if (Slide?.MediaType == MediaType.Text) { VideoDisplay.Visibility = Visibility.Hidden; ImgDisplay.Visibility = Visibility.Hidden; textDisplay.Visibility = Visibility.Visible; textDisplay.Text = Slide.Text; } } }
private void VideoDisplay_MediaEnded(object sender, RoutedEventArgs e) { VideoDisplay.Stop(); VideoDisplay.Volume = 0; VideoDisplay.Play(); }