From 4113104eff01ad13e457b46248e42b943e1faa23 Mon Sep 17 00:00:00 2001 From: ClemensFischer Date: Tue, 21 May 2024 14:39:53 +0200 Subject: [PATCH] warnings --- .../Avalonia/DependencyPropertyHelper.Avalonia.cs | 11 ++--------- MapControl/Avalonia/MapBase.Avalonia.cs | 2 +- MapControl/WinUI/DependencyPropertyHelper.WinUI.cs | 3 +-- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/MapControl/Avalonia/DependencyPropertyHelper.Avalonia.cs b/MapControl/Avalonia/DependencyPropertyHelper.Avalonia.cs index fbabc9e5..a65b37d4 100644 --- a/MapControl/Avalonia/DependencyPropertyHelper.Avalonia.cs +++ b/MapControl/Avalonia/DependencyPropertyHelper.Avalonia.cs @@ -2,9 +2,10 @@ using Avalonia.Controls; using System; +#pragma warning disable AVP1001 // The same AvaloniaProperty should not be registered twice + namespace MapControl { - [System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1001")] public static class DependencyPropertyHelper { public static StyledProperty Register( @@ -43,13 +44,5 @@ namespace MapControl return property; } - - public static DirectProperty RegisterReadOnly( - string name, - Func getter) - where TOwner : AvaloniaObject - { - return AvaloniaProperty.RegisterDirect(name, getter); - } } } diff --git a/MapControl/Avalonia/MapBase.Avalonia.cs b/MapControl/Avalonia/MapBase.Avalonia.cs index 6b7a05da..c61669fb 100644 --- a/MapControl/Avalonia/MapBase.Avalonia.cs +++ b/MapControl/Avalonia/MapBase.Avalonia.cs @@ -54,7 +54,7 @@ namespace MapControl (map, value) => map.CoerceHeadingProperty(value)); public static readonly DirectProperty ViewScaleProperty = - DependencyPropertyHelper.RegisterReadOnly(nameof(ViewScale), map => map.ViewScale); + AvaloniaProperty.RegisterDirect(nameof(ViewScale), map => map.ViewScale); private CancellationTokenSource centerCts; private CancellationTokenSource zoomLevelCts; diff --git a/MapControl/WinUI/DependencyPropertyHelper.WinUI.cs b/MapControl/WinUI/DependencyPropertyHelper.WinUI.cs index aef65d7d..fb0cffa4 100644 --- a/MapControl/WinUI/DependencyPropertyHelper.WinUI.cs +++ b/MapControl/WinUI/DependencyPropertyHelper.WinUI.cs @@ -8,6 +8,7 @@ using Microsoft.UI.Xaml; #else using Windows.UI.Xaml; #endif + #pragma warning disable IDE0060 // Remove unused parameter namespace MapControl @@ -43,5 +44,3 @@ namespace MapControl } } } - -#pragma warning restore IDE0060