Пример #1
0
        public VideoPlaybackWindow()
        {
            InitializeComponent();

            MainWindow.OnApplicationQuit += (object sender, EventArgs e) =>
            {
                Stop();
                Close();
            };

            instance              = this;
            mePlayer.MediaOpened += Player_MediaOpened;
            mePlayer.MediaEnded  += Player_MediaEnded;

            DispatcherTimer timer = new DispatcherTimer();

            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += Timer_Tick;
            timer.Start();
        }
Пример #2
0
        private void Player_MediaFailed(object sender, ExceptionRoutedEventArgs e)
        {
            if (!e.Handled && !string.IsNullOrEmpty(VideoFile) && attemptsCount < 2)
            {
                e.Handled = true;
                attemptsCount++;
                var wnd = new VideoPlaybackWindow();
                wnd.Show();
                if (ScreenHandler.AllScreens > 1)
                {
                    wnd.ShowOnMonitor(1);
                }
                wnd.WindowState = WindowState.Maximized;
                wnd.VideoFile   = VideoFile;
                wnd.Volume      = Volume;
                wnd.Play();

                Close();
            }
        }