From bf263f141b2f2f0ba54ca632cfb6ffd9460fb4b7 Mon Sep 17 00:00:00 2001 From: Ionite Date: Sun, 16 Jul 2023 16:15:44 -0400 Subject: [PATCH] Nullability and using fixes --- .../Controls/BetterAdvancedImage.cs | 1 + .../Controls/BetterContentDialog.cs | 1 - .../Controls/FASymbolIconSource.cs | 1 - StabilityMatrix.Avalonia/Controls/ProgressRing.cs | 14 +++++++------- .../Controls/RefreshBadge.axaml | 2 +- .../Controls/UserControlBase.cs | 4 +--- .../Converters/LaunchOptionConverter.cs | 4 ++-- .../Converters/ValueConverterGroup.cs | 5 +++-- .../DesignData/MockHttpClientFactory.cs | 5 +++-- .../DesignData/MockLiteDbContext.cs | 8 ++++---- StabilityMatrix.Avalonia/DialogHelper.cs | 7 +------ .../Models/ObservableDictionary.cs | 1 - StabilityMatrix.Avalonia/Program.cs | 4 ++-- .../Services/INotificationService.cs | 3 +-- .../Services/NavigationService.cs | 3 ++- .../Services/ServiceManager.cs | 2 ++ StabilityMatrix.Avalonia/Styles/ProgressRing.axaml | 4 ++-- .../ViewModels/CheckpointBrowserViewModel.cs | 3 +-- .../ViewModels/CheckpointFile.cs | 3 ++- .../ViewModels/CheckpointsPageViewModel.cs | 4 +--- .../ViewModels/Dialogs/InstallerViewModel.cs | 1 - .../ViewModels/Dialogs/LaunchOptionsViewModel.cs | 3 ++- .../ViewModels/LaunchPageViewModel.cs | 2 +- .../ViewModels/MainWindowViewModel.cs | 2 -- .../ViewModels/PageViewModelBase.cs | 1 - .../ViewModels/ProgressManagerViewModel.cs | 4 ---- .../ViewModels/SettingsViewModel.cs | 3 +-- .../Views/CheckpointBrowserPage.axaml.cs | 3 +-- .../Views/CheckpointsPage.axaml | 2 -- .../Views/Dialogs/InstallerDialog.axaml | 3 --- .../Views/Dialogs/LaunchOptionsDialog.axaml | 2 -- .../Views/Dialogs/LaunchOptionsDialog.axaml.cs | 3 +-- .../Views/Dialogs/OneClickInstallDialog.axaml | 1 - .../Views/Dialogs/OneClickInstallDialog.axaml.cs | 3 +-- .../Views/Dialogs/SelectDataDirectoryDialog.axaml | 1 - .../Views/Dialogs/SelectModelVersionDialog.axaml | 1 - .../Views/Dialogs/UpdateDialog.axaml | 2 -- .../Views/Dialogs/UpdateDialog.axaml.cs | 3 +-- StabilityMatrix.Avalonia/Views/MainWindow.axaml | 2 -- .../Views/ProgressManagerPage.axaml.cs | 4 +--- .../Helper/Factory/IPackageFactory.cs | 2 +- .../Helper/Factory/PackageFactory.cs | 5 +++-- .../Models/Packages/BaseGitPackage.cs | 8 +++----- .../Models/Packages/BasePackage.cs | 2 +- 44 files changed, 53 insertions(+), 89 deletions(-) diff --git a/StabilityMatrix.Avalonia/Controls/BetterAdvancedImage.cs b/StabilityMatrix.Avalonia/Controls/BetterAdvancedImage.cs index 9e9c1545..8f5f4502 100644 --- a/StabilityMatrix.Avalonia/Controls/BetterAdvancedImage.cs +++ b/StabilityMatrix.Avalonia/Controls/BetterAdvancedImage.cs @@ -9,6 +9,7 @@ using Avalonia.Media; namespace StabilityMatrix.Avalonia.Controls; [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +[SuppressMessage("ReSharper", "UnusedMember.Local")] public class BetterAdvancedImage : AdvancedImage { #region Reflection Shenanigans to access private parent fields diff --git a/StabilityMatrix.Avalonia/Controls/BetterContentDialog.cs b/StabilityMatrix.Avalonia/Controls/BetterContentDialog.cs index bfbf1e4b..dd444ab3 100644 --- a/StabilityMatrix.Avalonia/Controls/BetterContentDialog.cs +++ b/StabilityMatrix.Avalonia/Controls/BetterContentDialog.cs @@ -5,7 +5,6 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.Interactivity; -using Avalonia.Styling; using Avalonia.Threading; using FluentAvalonia.UI.Controls; using StabilityMatrix.Avalonia.ViewModels; diff --git a/StabilityMatrix.Avalonia/Controls/FASymbolIconSource.cs b/StabilityMatrix.Avalonia/Controls/FASymbolIconSource.cs index 84ff75ca..bc5c84e6 100644 --- a/StabilityMatrix.Avalonia/Controls/FASymbolIconSource.cs +++ b/StabilityMatrix.Avalonia/Controls/FASymbolIconSource.cs @@ -1,6 +1,5 @@ using System; using System.ComponentModel; -using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using Avalonia; diff --git a/StabilityMatrix.Avalonia/Controls/ProgressRing.cs b/StabilityMatrix.Avalonia/Controls/ProgressRing.cs index d7c1daf0..f1a5b56c 100644 --- a/StabilityMatrix.Avalonia/Controls/ProgressRing.cs +++ b/StabilityMatrix.Avalonia/Controls/ProgressRing.cs @@ -20,10 +20,10 @@ public class ProgressRing : RangeBase AvaloniaProperty.Register(nameof(PreserveAspect), true); public static readonly StyledProperty ValueAngleProperty = - AvaloniaProperty.Register(nameof(ValueAngle), 0); + AvaloniaProperty.Register(nameof(ValueAngle)); public static readonly StyledProperty StartAngleProperty = - AvaloniaProperty.Register(nameof(StartAngle), 0); + AvaloniaProperty.Register(nameof(StartAngle)); public static readonly StyledProperty EndAngleProperty = AvaloniaProperty.Register(nameof(EndAngle), 360); @@ -105,26 +105,26 @@ public class ProgressRing : RangeBase private static void OnMinimumPropertyChanged(ProgressRing sender, AvaloniaPropertyChangedEventArgs e) { - sender.Minimum = (double)e.NewValue; + sender.Minimum = (double) e.NewValue!; } private static void OnMaximumPropertyChanged(ProgressRing sender, AvaloniaPropertyChangedEventArgs e) { - sender.Maximum = (double)e.NewValue; + sender.Maximum = (double) e.NewValue!; } private static void OnValuePropertyChanged(ProgressRing sender, AvaloniaPropertyChangedEventArgs e) { - sender.ValueAngle = ((double)e.NewValue - sender.Minimum) * (sender.EndAngle - sender.StartAngle) / (sender.Maximum - sender.Minimum); + sender.ValueAngle = ((double) e.NewValue! - sender.Minimum) * (sender.EndAngle - sender.StartAngle) / (sender.Maximum - sender.Minimum); } private static void OnStartAnglePropertyChanged(ProgressRing sender, AvaloniaPropertyChangedEventArgs e) { - sender.StartAngle = (double)e.NewValue; + sender.StartAngle = (double) e.NewValue!; } private static void OnEndAnglePropertyChanged(ProgressRing sender, AvaloniaPropertyChangedEventArgs e) { - sender.EndAngle = (double)e.NewValue; + sender.EndAngle = (double) e.NewValue!; } } diff --git a/StabilityMatrix.Avalonia/Controls/RefreshBadge.axaml b/StabilityMatrix.Avalonia/Controls/RefreshBadge.axaml index 4a83417a..0a286771 100644 --- a/StabilityMatrix.Avalonia/Controls/RefreshBadge.axaml +++ b/StabilityMatrix.Avalonia/Controls/RefreshBadge.axaml @@ -11,7 +11,7 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="StabilityMatrix.Avalonia.Controls.RefreshBadge"> - +