From d64c448cdacb4836e0539371e43aacc10268ca8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E6=80=A1=E9=A3=9E?= <363301617@qq.com> Date: Tue, 31 Dec 2024 22:18:08 +0800 Subject: [PATCH] Finishing 2024: Fixing some warnings and improving code quality Finishing 2024: Fixing some warnings and improving code quality --- WindowsTools/UI/Backdrop/DesktopAcrylicBrush.cs | 4 ++-- WindowsTools/UI/Backdrop/MicaBrush.cs | 4 ++-- WindowsTools/UI/Dialogs/AppInformationDialog.xaml.cs | 4 ++-- WindowsTools/Views/Pages/PriExtractPage.xaml.cs | 4 ++-- WindowsTools/Views/Pages/WinSATPage.xaml | 5 ++++- WindowsTools/Views/Windows/LoafWindow.cs | 2 +- WindowsTools/WindowsAPI/PInvoke/User32/SM.cs | 2 +- WindowsToolsShellExtension/Commands/ExplorerCommand.cs | 3 +++ 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/WindowsTools/UI/Backdrop/DesktopAcrylicBrush.cs b/WindowsTools/UI/Backdrop/DesktopAcrylicBrush.cs index d7a2c52..4a9d5cf 100644 --- a/WindowsTools/UI/Backdrop/DesktopAcrylicBrush.cs +++ b/WindowsTools/UI/Backdrop/DesktopAcrylicBrush.cs @@ -11,8 +11,8 @@ using WindowsTools.WindowsAPI.PInvoke.Kernel32; using WindowsTools.WindowsAPI.PInvoke.User32; -// 抑制 CA1822 警告 -#pragma warning disable CA1822 +// 抑制 CA1822,IDE0060 警告 +#pragma warning disable CA1822,IDE0060 namespace WindowsTools.UI.Backdrop { diff --git a/WindowsTools/UI/Backdrop/MicaBrush.cs b/WindowsTools/UI/Backdrop/MicaBrush.cs index 5d33938..b6e32f6 100644 --- a/WindowsTools/UI/Backdrop/MicaBrush.cs +++ b/WindowsTools/UI/Backdrop/MicaBrush.cs @@ -13,8 +13,8 @@ using WindowsTools.WindowsAPI.PInvoke.Kernel32; using WindowsTools.WindowsAPI.PInvoke.User32; -// 抑制 CA1822 警告 -#pragma warning disable CA1822 +// 抑制 CA1822,IDE0060 警告 +#pragma warning disable CA1822,IDE0060 namespace WindowsTools.UI.Backdrop { diff --git a/WindowsTools/UI/Dialogs/AppInformationDialog.xaml.cs b/WindowsTools/UI/Dialogs/AppInformationDialog.xaml.cs index 7dee29c..060bfc4 100644 --- a/WindowsTools/UI/Dialogs/AppInformationDialog.xaml.cs +++ b/WindowsTools/UI/Dialogs/AppInformationDialog.xaml.cs @@ -16,8 +16,8 @@ using WindowsTools.UI.TeachingTips; using WindowsTools.WindowsAPI.PInvoke.KernelAppCore; -// 抑制 CA1806 警告 -#pragma warning disable CA1806 +// 抑制 CA1806,IDE0060 警告 +#pragma warning disable CA1806,IDE0060 namespace WindowsTools.UI.Dialogs { diff --git a/WindowsTools/Views/Pages/PriExtractPage.xaml.cs b/WindowsTools/Views/Pages/PriExtractPage.xaml.cs index dc9ea3b..e2a7c74 100644 --- a/WindowsTools/Views/Pages/PriExtractPage.xaml.cs +++ b/WindowsTools/Views/Pages/PriExtractPage.xaml.cs @@ -27,8 +27,8 @@ using WindowsTools.WindowsAPI.ComTypes; using WindowsTools.WindowsAPI.PInvoke.Shell32; -// 抑制 CA1806,IDE0060 警告 -#pragma warning disable CA1806,IDE0060 +// 抑制 CA1806,CA1822,IDE0060 警告 +#pragma warning disable CA1806,CA1822,IDE0060 namespace WindowsTools.Views.Pages { diff --git a/WindowsTools/Views/Pages/WinSATPage.xaml b/WindowsTools/Views/Pages/WinSATPage.xaml index 4a2f447..63b68d2 100644 --- a/WindowsTools/Views/Pages/WinSATPage.xaml +++ b/WindowsTools/Views/Pages/WinSATPage.xaml @@ -36,7 +36,10 @@ + Background="{ThemeResource CardBackgroundFillColorDefaultBrush}" + BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}" + BorderThickness="1" + CornerRadius="{StaticResource ControlCornerRadius}"> diff --git a/WindowsTools/Views/Windows/LoafWindow.cs b/WindowsTools/Views/Windows/LoafWindow.cs index f55639d..c17163f 100644 --- a/WindowsTools/Views/Windows/LoafWindow.cs +++ b/WindowsTools/Views/Windows/LoafWindow.cs @@ -81,7 +81,7 @@ protected override void OnFormClosed(FormClosedEventArgs args) protected override void OnSizeChanged(EventArgs args) { base.OnSizeChanged(args); - User32Library.SetWindowPos(hwndXamlIsland, IntPtr.Zero, Location.X, Location.Y, Width, Height, SetWindowPosFlags.SWP_NOACTIVATE | SetWindowPosFlags.SWP_NOZORDER | SetWindowPosFlags.SWP_SHOWWINDOW); + User32Library.SetWindowPos(hwndXamlIsland, IntPtr.Zero, 0, 0, Width, Height, SetWindowPosFlags.SWP_NOACTIVATE | SetWindowPosFlags.SWP_NOZORDER | SetWindowPosFlags.SWP_SHOWWINDOW); } /// diff --git a/WindowsTools/WindowsAPI/PInvoke/User32/SM.cs b/WindowsTools/WindowsAPI/PInvoke/User32/SM.cs index 91445f6..0b3c149 100644 --- a/WindowsTools/WindowsAPI/PInvoke/User32/SM.cs +++ b/WindowsTools/WindowsAPI/PInvoke/User32/SM.cs @@ -70,7 +70,7 @@ public enum SM : int /// 窗口周围具有描述文字但不是相当大的(以像素为单位)的框架的粗细。 SM_CXFIXEDFRAME是水平边框的高度,SM_CYFIXEDFRAME是垂直边框的宽度。 /// 此值与 SM_CXDLGFRAME 相同。 /// - SM_CXFIXEDFRAME = 7, + SM_CXFIXEDFRAME = SM_CXDLGFRAME, /// /// DrawFocusRect 绘制的焦点矩形的左边缘和右边缘的宽度。 此值以像素为单位。 diff --git a/WindowsToolsShellExtension/Commands/ExplorerCommand.cs b/WindowsToolsShellExtension/Commands/ExplorerCommand.cs index 23b036d..985e7c7 100644 --- a/WindowsToolsShellExtension/Commands/ExplorerCommand.cs +++ b/WindowsToolsShellExtension/Commands/ExplorerCommand.cs @@ -12,6 +12,9 @@ using WindowsToolsShellExtension.WindowsAPI.PInvoke.Shell32; using WindowsToolsShellExtension.WindowsAPI.PInvoke.Shlwapi; +// 抑制 CA1822 警告 +#pragma warning disable CA1822 + namespace WindowsToolsShellExtension.Commands { ///