diff --git a/LightBulb.PlatformInterop/Internal/WndProcSponge.cs b/LightBulb.PlatformInterop/Internal/WndProcSponge.cs index 2b8e38c..247491f 100644 --- a/LightBulb.PlatformInterop/Internal/WndProcSponge.cs +++ b/LightBulb.PlatformInterop/Internal/WndProcSponge.cs @@ -46,12 +46,9 @@ internal partial class WndProcSponge { private const string ClassName = "LightBulb.WndProcSponge"; - private static readonly Lazy DefaultLazy = - new( - () => - TryCreate() - ?? throw new InvalidOperationException("Failed to create WndProc sponge.") - ); + private static readonly Lazy DefaultLazy = new( + () => TryCreate() ?? throw new InvalidOperationException("Failed to create WndProc sponge.") + ); public static WndProcSponge Default => DefaultLazy.Value; diff --git a/LightBulb/Framework/DialogViewModelBase.cs b/LightBulb/Framework/DialogViewModelBase.cs index 51a47f9..5cb1f6e 100644 --- a/LightBulb/Framework/DialogViewModelBase.cs +++ b/LightBulb/Framework/DialogViewModelBase.cs @@ -6,8 +6,9 @@ namespace LightBulb.Framework; public abstract partial class DialogViewModelBase : ViewModelBase { - private readonly TaskCompletionSource _closeTcs = - new(TaskCreationOptions.RunContinuationsAsynchronously); + private readonly TaskCompletionSource _closeTcs = new( + TaskCreationOptions.RunContinuationsAsynchronously + ); [ObservableProperty] private T? _dialogResult; diff --git a/LightBulb/Services/ExternalApplicationService.cs b/LightBulb/Services/ExternalApplicationService.cs index 0c37695..7234817 100644 --- a/LightBulb/Services/ExternalApplicationService.cs +++ b/LightBulb/Services/ExternalApplicationService.cs @@ -9,8 +9,12 @@ namespace LightBulb.Services; public class ExternalApplicationService { // Applications that we don't want to show to the user - private readonly HashSet _ignoredApplicationNames = - new(StringComparer.OrdinalIgnoreCase) { "explorer" }; + private readonly HashSet _ignoredApplicationNames = new( + StringComparer.OrdinalIgnoreCase + ) + { + "explorer", + }; public IEnumerable GetAllRunningApplications() { diff --git a/LightBulb/Services/SettingsService.cs b/LightBulb/Services/SettingsService.cs index 8b62564..71b5ffc 100644 --- a/LightBulb/Services/SettingsService.cs +++ b/LightBulb/Services/SettingsService.cs @@ -19,21 +19,19 @@ namespace LightBulb.Services; [INotifyPropertyChanged] public partial class SettingsService() : SettingsBase(GetFilePath(), SerializerContext.Default) { - private readonly RegistrySwitch _extendedGammaRangeSwitch = - new( - RegistryHive.LocalMachine, - @"Software\Microsoft\Windows NT\CurrentVersion\ICM", - "GdiICMGammaRange", - 256 - ); - - private readonly RegistrySwitch _autoStartSwitch = - new( - RegistryHive.CurrentUser, - @"Software\Microsoft\Windows\CurrentVersion\Run", - Program.Name, - $"\"{Program.ExecutableFilePath}\" {StartOptions.IsInitiallyHiddenArgument}" - ); + private readonly RegistrySwitch _extendedGammaRangeSwitch = new( + RegistryHive.LocalMachine, + @"Software\Microsoft\Windows NT\CurrentVersion\ICM", + "GdiICMGammaRange", + 256 + ); + + private readonly RegistrySwitch _autoStartSwitch = new( + RegistryHive.CurrentUser, + @"Software\Microsoft\Windows\CurrentVersion\Run", + Program.Name, + $"\"{Program.ExecutableFilePath}\" {StartOptions.IsInitiallyHiddenArgument}" + ); private bool _isFirstTimeExperienceEnabled = true; public bool IsFirstTimeExperienceEnabled diff --git a/LightBulb/ViewModels/MainViewModel.cs b/LightBulb/ViewModels/MainViewModel.cs index e923ee4..656fe5d 100644 --- a/LightBulb/ViewModels/MainViewModel.cs +++ b/LightBulb/ViewModels/MainViewModel.cs @@ -20,23 +20,22 @@ public partial class MainViewModel( UpdateService updateService ) : ViewModelBase { - private readonly Timer _checkForUpdatesTimer = - new( - TimeSpan.FromHours(3), - async () => + private readonly Timer _checkForUpdatesTimer = new( + TimeSpan.FromHours(3), + async () => + { + try { - try - { - var updateVersion = await updateService.CheckForUpdatesAsync(); - if (updateVersion is not null) - await updateService.PrepareUpdateAsync(updateVersion); - } - catch - { - // Failure to update shouldn't crash the application - } + var updateVersion = await updateService.CheckForUpdatesAsync(); + if (updateVersion is not null) + await updateService.PrepareUpdateAsync(updateVersion); } - ); + catch + { + // Failure to update shouldn't crash the application + } + } + ); public DashboardViewModel Dashboard { get; } = viewModelManager.CreateDashboardViewModel();