Skip to content

Commit 24094b4

Browse files
committed
Minor styling fixes
1 parent 16923b2 commit 24094b4

File tree

7 files changed

+12
-19
lines changed

7 files changed

+12
-19
lines changed

src/Camelot.Services.Abstractions/IAppearanceSettingsService.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Camelot.Services.Abstractions.Models;
2-
using Camelot.Services.Abstractions.Models.Enums;
32

43
namespace Camelot.Services.Abstractions;
54

src/Camelot.Services.Environment/Models/DriveInfo.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using DriveType = System.IO.DriveType;
2-
using IoDriveInfo = System.IO.DriveInfo;
32

43
namespace Camelot.Services.Environment.Models;
54

src/Camelot.Services/AppearanceSettingsService.cs

+8-12
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
42
using Camelot.DataAccess.UnitOfWork;
53
using Camelot.Services.Abstractions;
64
using Camelot.Services.Abstractions.Models;
7-
using Camelot.Services.Abstractions.Models.Enums;
85

96
namespace Camelot.Services;
107

118
public class AppearanceSettingsService : IAppearanceSettingsService
129
{
1310
private const string SettingsId = "AppearanceSettings";
11+
1412
private readonly AppearanceSettingsModel _default;
1513
private readonly IUnitOfWorkFactory _unitOfWorkFactory;
14+
1615
private AppearanceSettingsModel _cachedSettingsValue;
16+
1717
public AppearanceSettingsService(IUnitOfWorkFactory unitOfWorkFactory)
1818
{
1919
_unitOfWorkFactory = unitOfWorkFactory;
@@ -28,27 +28,23 @@ public AppearanceSettingsModel GetAppearanceSettings()
2828
using var uow = _unitOfWorkFactory.Create();
2929
var repository = uow.GetRepository<AppearanceSettingsModel>();
3030
var dbModel = repository.GetById(SettingsId);
31-
if (dbModel != null)
32-
_cachedSettingsValue = dbModel;
33-
else
34-
_cachedSettingsValue = _default;
35-
}
36-
else
37-
{
38-
// we set value of _cachedValue in 'save',
39-
// so no need to read from the repository every time.
31+
_cachedSettingsValue = dbModel ?? _default;
4032
}
33+
4134
return _cachedSettingsValue;
4235
}
4336

4437

4538
public void SaveAppearanceSettings(AppearanceSettingsModel appearanceSettingsModel)
4639
{
4740
if (appearanceSettingsModel == null)
41+
{
4842
throw new ArgumentNullException(nameof(appearanceSettingsModel));
43+
}
4944

5045
using var uow = _unitOfWorkFactory.Create();
5146
var repository = uow.GetRepository<AppearanceSettingsModel>();
47+
5248
repository.Upsert(SettingsId, appearanceSettingsModel);
5349
_cachedSettingsValue = appearanceSettingsModel;
5450
}

src/Camelot.ViewModels.Windows/ShellIcons/WindowsShellIconsService.cs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using Camelot.ViewModels.Services.Interfaces.Enums;
44
using Camelot.ViewModels.Services.Interfaces.Models;
55
using Camelot.ViewModels.Windows.WinApi;
6-
using SystemBitmap = System.Drawing.Bitmap;
76
using AvaloniaBitmap = Avalonia.Media.Imaging.Bitmap;
87

98
namespace Camelot.ViewModels.Windows.ShellIcons;

src/Camelot.ViewModels.Windows/WinApi/ShellIcon.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Camelot.Services.Windows.WinApi;
2-
using System.Diagnostics;
32

43
namespace Camelot.ViewModels.Windows.WinApi;
54

src/Camelot.ViewModels/Implementations/Settings/AppearanceSettingsViewModel.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class AppearanceSettingsViewModel : ViewModelBase, ISettingsViewModel
1717

1818

1919
public bool IsChanged => _initialShowKeyboardShortcuts != ShowKeyboardShortcuts;
20-
20+
2121
public AppearanceSettingsViewModel(
2222
IAppearanceSettingsService appearanceSettingService)
2323
{
@@ -34,13 +34,13 @@ public void Activate()
3434
_isActivated = true;
3535

3636
var model = _appearanceSettingService.GetAppearanceSettings();
37-
_initialShowKeyboardShortcuts = model.ShowKeyboardShortcuts;
38-
ShowKeyboardShortcuts = _initialShowKeyboardShortcuts;
37+
ShowKeyboardShortcuts = _initialShowKeyboardShortcuts = model.ShowKeyboardShortcuts;
3938
}
4039

4140
public void SaveChanges()
4241
{
4342
var model = new AppearanceSettingsModel(ShowKeyboardShortcuts);
43+
4444
_appearanceSettingService.SaveAppearanceSettings(model);
4545
}
4646
}

src/Camelot/Views/Dialogs/Settings/AppearanceSettingsView.xaml.cs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Avalonia.Markup.Xaml;
33

44
namespace Camelot.Views.Dialogs.Settings;
5+
56
public class AppearanceSettingsView : UserControl
67
{
78
public AppearanceSettingsView()

0 commit comments

Comments
 (0)