private void loadLiveOutputWindow(string path) { _liveOutputWindow = new LiveOutputWindow(); //second monitor full screen try { int screens = System.Windows.Forms.Screen.AllScreens.Count<Screen>(); var area = System.Windows.Forms.Screen.AllScreens[screens - 1].WorkingArea; _liveOutputWindow.WindowStyle = System.Windows.WindowStyle.SingleBorderWindow; _liveOutputWindow.Left = area.Left; _liveOutputWindow.Top = area.Top; _liveOutputWindow.Width = 320; _liveOutputWindow.Height = 240; if (screens > 1) { _liveOutputWindow.WindowStyle = System.Windows.WindowStyle.None; _liveOutputWindow.Loaded += (sender, e) => { _liveOutputWindow.WindowState = WindowState.Maximized; }; } // get mediaplayer _liveOutputMediaPlayer = (MediaElement)_liveOutputWindow.FindName("VideoPlayer"); _liveOutputMediaPlayer.MediaOpened += _liveOutputMediaPlayer_MediaOpened; // load static image setVideo(new Uri(path, UriKind.Absolute)); // set preview player fill VideoDisplay.Fill = new VisualBrush(_liveOutputMediaPlayer); } catch (Exception ex) { System.Diagnostics.EventLog.WriteEntry("Application", ex.Message); } }
private void Window_Closed(object sender, EventArgs e) { _audioPlayer.Stop(); _liveOutputMediaPlayer.Clock = null; //.Controller.Stop(); _liveOutputWindow.Close(); _liveOutputWindow = null; }