From 67f31389702e10582fa366aa4140a193d18c87e1 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Tue, 25 Jul 2023 14:57:10 -0500 Subject: [PATCH 1/2] Suppress CA1060 --- CommunityToolkit.App.Shared/Controls/TitleBar/NativeMethods.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CommunityToolkit.App.Shared/Controls/TitleBar/NativeMethods.cs b/CommunityToolkit.App.Shared/Controls/TitleBar/NativeMethods.cs index 16417dee..1ce9943c 100644 --- a/CommunityToolkit.App.Shared/Controls/TitleBar/NativeMethods.cs +++ b/CommunityToolkit.App.Shared/Controls/TitleBar/NativeMethods.cs @@ -12,8 +12,10 @@ namespace CommunityToolkit.App.Shared.Controls; public partial class TitleBar : Control { + #pragma warning disable CA1060 // Move pinvokes to native methods class [DllImport("Shcore.dll", SetLastError = true)] internal static extern int GetDpiForMonitor(IntPtr hmonitor, Monitor_DPI_Type dpiType, out uint dpiX, out uint dpiY); + #pragma warning restore CA1060 internal enum Monitor_DPI_Type : int { From fc63e595cc4e8bb3c7942421ffd7ba27c050ed34 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Tue, 25 Jul 2023 16:25:55 -0500 Subject: [PATCH 2/2] Move CA1060 suppression to cover class def --- .../Controls/TitleBar/NativeMethods.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CommunityToolkit.App.Shared/Controls/TitleBar/NativeMethods.cs b/CommunityToolkit.App.Shared/Controls/TitleBar/NativeMethods.cs index 1ce9943c..aee12684 100644 --- a/CommunityToolkit.App.Shared/Controls/TitleBar/NativeMethods.cs +++ b/CommunityToolkit.App.Shared/Controls/TitleBar/NativeMethods.cs @@ -10,12 +10,11 @@ namespace CommunityToolkit.App.Shared.Controls; +#pragma warning disable CA1060 // Move pinvokes to native methods class public partial class TitleBar : Control { - #pragma warning disable CA1060 // Move pinvokes to native methods class [DllImport("Shcore.dll", SetLastError = true)] internal static extern int GetDpiForMonitor(IntPtr hmonitor, Monitor_DPI_Type dpiType, out uint dpiX, out uint dpiY); - #pragma warning restore CA1060 internal enum Monitor_DPI_Type : int { @@ -44,3 +43,4 @@ private double GetScaleAdjustment() } } #endif +#pragma warning restore CA1060