Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz committed Jan 2, 2025
1 parent 84c5130 commit c5ccfc4
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 40 deletions.
9 changes: 3 additions & 6 deletions LightBulb.PlatformInterop/Internal/WndProcSponge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,9 @@ internal partial class WndProcSponge
{
private const string ClassName = "LightBulb.WndProcSponge";

private static readonly Lazy<WndProcSponge> DefaultLazy =
new(
() =>
TryCreate()
?? throw new InvalidOperationException("Failed to create WndProc sponge.")
);
private static readonly Lazy<WndProcSponge> DefaultLazy = new(
() => TryCreate() ?? throw new InvalidOperationException("Failed to create WndProc sponge.")
);

public static WndProcSponge Default => DefaultLazy.Value;

Expand Down
5 changes: 3 additions & 2 deletions LightBulb/Framework/DialogViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ namespace LightBulb.Framework;

public abstract partial class DialogViewModelBase<T> : ViewModelBase
{
private readonly TaskCompletionSource<T> _closeTcs =
new(TaskCreationOptions.RunContinuationsAsynchronously);
private readonly TaskCompletionSource<T> _closeTcs = new(
TaskCreationOptions.RunContinuationsAsynchronously
);

[ObservableProperty]
private T? _dialogResult;
Expand Down
8 changes: 6 additions & 2 deletions LightBulb/Services/ExternalApplicationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ namespace LightBulb.Services;
public class ExternalApplicationService
{
// Applications that we don't want to show to the user
private readonly HashSet<string> _ignoredApplicationNames =
new(StringComparer.OrdinalIgnoreCase) { "explorer" };
private readonly HashSet<string> _ignoredApplicationNames = new(
StringComparer.OrdinalIgnoreCase
)
{
"explorer",
};

public IEnumerable<ExternalApplication> GetAllRunningApplications()
{
Expand Down
28 changes: 13 additions & 15 deletions LightBulb/Services/SettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,19 @@ namespace LightBulb.Services;
[INotifyPropertyChanged]
public partial class SettingsService() : SettingsBase(GetFilePath(), SerializerContext.Default)
{
private readonly RegistrySwitch<int> _extendedGammaRangeSwitch =
new(
RegistryHive.LocalMachine,
@"Software\Microsoft\Windows NT\CurrentVersion\ICM",
"GdiICMGammaRange",
256
);

private readonly RegistrySwitch<string> _autoStartSwitch =
new(
RegistryHive.CurrentUser,
@"Software\Microsoft\Windows\CurrentVersion\Run",
Program.Name,
$"\"{Program.ExecutableFilePath}\" {StartOptions.IsInitiallyHiddenArgument}"
);
private readonly RegistrySwitch<int> _extendedGammaRangeSwitch = new(
RegistryHive.LocalMachine,
@"Software\Microsoft\Windows NT\CurrentVersion\ICM",
"GdiICMGammaRange",
256
);

private readonly RegistrySwitch<string> _autoStartSwitch = new(
RegistryHive.CurrentUser,
@"Software\Microsoft\Windows\CurrentVersion\Run",
Program.Name,
$"\"{Program.ExecutableFilePath}\" {StartOptions.IsInitiallyHiddenArgument}"
);

private bool _isFirstTimeExperienceEnabled = true;
public bool IsFirstTimeExperienceEnabled
Expand Down
29 changes: 14 additions & 15 deletions LightBulb/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit c5ccfc4

Please sign in to comment.