Inheritance: System.Windows.Window
        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 ShowPreview(IntPtr previewHwnd)
        {
            var mediaElementController = new PrimayScreenOnlyController(_movieManager, 1);
            var window = new ScreenSaverWindow(mediaElementController, 0);

            mediaElementController.Start();

            var lpRect   = new RECT();
            var bGetRect = Win32API.GetClientRect(previewHwnd, ref lpRect);

            Debug.Assert(bGetRect);

            var sourceParams = new HwndSourceParameters("sourceParams")
            {
                PositionX    = 0,
                PositionY    = 0,
                Height       = lpRect.Bottom - lpRect.Top,
                Width        = lpRect.Right - lpRect.Left,
                ParentWindow = previewHwnd,
                WindowStyle  = (int)(WindowStyles.WS_VISIBLE | WindowStyles.WS_CHILD | WindowStyles.WS_CLIPCHILDREN)
            };

            _winWpfContent            = new HwndSource(sourceParams);
            _winWpfContent.Disposed  += (_, __) => window.Close();
            _winWpfContent.RootVisual = (Visual)window.Content;

            UpdateManager.Instance.CheckForUpdatesAsync();
        }
Exemple #3
0
        private void ShowPreview(IntPtr previewHwnd)
        {
            var mediaElementController = new PrimayScreenOnlyController(_movieManager, 1);
            var window = new ScreenSaverWindow(mediaElementController, 0);
            mediaElementController.Start();

            var lpRect = new RECT();
            var bGetRect = Win32API.GetClientRect(previewHwnd, ref lpRect);
            Debug.Assert(bGetRect);

            var sourceParams = new HwndSourceParameters("sourceParams") {
                PositionX = 0,
                PositionY = 0,
                Height = lpRect.Bottom - lpRect.Top,
                Width = lpRect.Right - lpRect.Left,
                ParentWindow = previewHwnd,
                WindowStyle = (int) (WindowStyles.WS_VISIBLE | WindowStyles.WS_CHILD | WindowStyles.WS_CLIPCHILDREN)
            };

            _winWpfContent = new HwndSource(sourceParams);
            _winWpfContent.Disposed += (_, __) => window.Close();
            _winWpfContent.RootVisual = (Visual) window.Content;

            UpdateManager.Instance.CheckForUpdatesAsync();
        }
Exemple #4
0
        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();
        }