From 626340a6225450c19d0951e22630835ea5d4a577 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 04:06:54 +0000 Subject: [PATCH] Add namespace alias, null check, and improve code readability Co-authored-by: emako <24737061+emako@users.noreply.github.com> --- QuickLook/ViewerWindow.Actions.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/QuickLook/ViewerWindow.Actions.cs b/QuickLook/ViewerWindow.Actions.cs index 36b8e44..cdd5908 100644 --- a/QuickLook/ViewerWindow.Actions.cs +++ b/QuickLook/ViewerWindow.Actions.cs @@ -28,12 +28,12 @@ using System.Linq; using System.Runtime.ExceptionServices; using System.Windows; using System.Windows.Controls; -using System.Windows.Forms; using System.Windows.Input; using System.Windows.Interop; using System.Windows.Media; using System.Windows.Threading; using Wpf.Ui.Controls; +using WinForms = System.Windows.Forms; using MenuItem = System.Windows.Controls.MenuItem; namespace QuickLook; @@ -105,7 +105,8 @@ public partial class ViewerWindow } // Get the screen bounds where the window is currently located - var screen = Screen.FromHandle(new WindowInteropHelper(this).Handle); + var screen = WinForms.Screen.FromHandle(new WindowInteropHelper(this).Handle) ?? WinForms.Screen.PrimaryScreen; + var screenBounds = screen.Bounds; // Set to normal state first to allow manual positioning WindowState = WindowState.Normal; @@ -115,10 +116,10 @@ public partial class ViewerWindow ResizeMode = ResizeMode.NoResize; // Set window to cover the entire screen - Left = screen.Bounds.Left; - Top = screen.Bounds.Top; - Width = screen.Bounds.Width; - Height = screen.Bounds.Height; + Left = screenBounds.Left; + Top = screenBounds.Top; + Width = screenBounds.Width; + Height = screenBounds.Height; } }