private void ShowScreensaver() { var movieController = AppEnvironment.IsRemoteSession && Settings.Instance.BlankOnRemoteDesktop ? null : MediaElementController.CreateController(_movieManager, Screen.AllScreens.Length); for (var i = 0; i < Screen.AllScreens.Length; ++i) { var screen = Screen.AllScreens[i]; Window window = new ScreenSaverWindow(movieController, i); window.Left = screen.Bounds.Left; window.Top = screen.Bounds.Top; window.Width = screen.Bounds.Width; window.Height = screen.Bounds.Height; window.Topmost = true; window.Loaded += (_, __) => { window.WindowState = WindowState.Maximized; }; window.MouseDown += (_, __) => { Current.Shutdown(); }; window.KeyDown += (_, __) => { Current.Shutdown(); }; window.Show(); } movieController?.Start(); UpdateManager.Instance.CheckForUpdatesAsync(); }
private void LoadMovies() { if (MediaElement1 != null) { MediaElement1.UnloadedBehavior = MediaState.Manual; MediaElement1.MediaOpened -= MediaOpened; MediaElement1.Stop(); } if (MediaElement2 != null) { MediaElement2.UnloadedBehavior = MediaState.Manual; MediaElement2.MediaOpened -= MediaOpened; MediaElement2.Stop(); } var movieController = MediaElementController.CreateController(_movieManager, 2); MediaElement1 = movieController.MediaElements[0]; MediaElement2 = movieController.MediaElements[1]; MediaElement1.MediaOpened += MediaOpened; if (MediaElement2 != null) { MediaElement2.MediaOpened += MediaOpened; } movieController.Start(); }