Skip to content

Commit 59f3685

Browse files
committed
Cleaned up some code
1 parent ede9bc4 commit 59f3685

File tree

50 files changed

+183
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+183
-194
lines changed

SecureFolderFS.Backend/Extensions/LocalizationExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public static class LocalizationExtensions
99

1010
public static string? ToLocalized(this string resourceKey, ILocalizationService? localizationService = null)
1111
{
12-
if (localizationService == null)
12+
if (localizationService is null)
1313
{
1414
FallbackLocalizationService ??= Ioc.Default.GetService<ILocalizationService>();
1515
return FallbackLocalizationService?.LocalizeFromResourceKey(resourceKey) ?? string.Empty;

SecureFolderFS.Backend/Models/DashboardNavigationModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private void NavigateToPage(VaultDashboardPageType vaultDashboardPageType, BaseD
5050
public void Receive(DashboardNavigationRequestedMessage message)
5151
{
5252
BaseDashboardPageViewModel? baseDashboardPageViewModel;
53-
if (message.Value == null)
53+
if (message.Value is null)
5454
{
5555
baseDashboardPageViewModel = NavigateToPage(message.VaultDashboardPageType, message.VaultViewModel);
5656
}

SecureFolderFS.Backend/Models/IGraphManagerModel.cs renamed to SecureFolderFS.Backend/Models/IGraphModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace SecureFolderFS.Backend.Models
22
{
3-
public interface IGraphManagerModel
3+
public interface IGraphModel
44
{
55
void AddPoint(GraphPointModel point);
66
}

SecureFolderFS.Backend/Models/SavedVaultsModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public SavedVaultsModel()
2626

2727
public void Initialize()
2828
{
29-
if (InitializableSource != null && (SettingsService.IsAvailable && ConfidentialStorageService.IsAvailable))
29+
if (InitializableSource is not null && (SettingsService.IsAvailable && ConfidentialStorageService.IsAvailable))
3030
{
3131
var savedVaults = SettingsService.SavedVaults;
3232
var savedVaultModels = ConfidentialStorageService.SavedVaultModels;

SecureFolderFS.Backend/Models/SearchModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public bool SubmitQuery(string? query)
4545

4646
public void ResetSearch()
4747
{
48-
if (_savedItems != null)
48+
if (_savedItems is not null)
4949
{
5050
Collection!.EnumeratedAdd(_savedItems);
5151
_savedItems = null;

SecureFolderFS.Backend/Models/VaultIoSpeedReporterModel.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ public sealed class VaultIoSpeedReporterModel : BaseVaultIoSpeedReporterModel
1818

1919
private readonly List<long> _writeRates;
2020

21-
private long _readAmountBeforeFlush;
21+
private int _updateTimerInterval;
2222

23-
private long _writeAmountBeforeFlush;
23+
private long _readAmountBeforeFlush;
2424

25-
private int _updateTimerInterval;
25+
private long _writeAmountBeforeFlush;
2626

27-
public IProgress<double>? ReadGraphProgress { get; }
27+
private IProgress<double>? ReadGraphProgress { get; }
2828

29-
public IProgress<double>? WriteGraphProgress { get; }
29+
private IProgress<double>? WriteGraphProgress { get; }
3030

31-
public IGraphManagerModel? ReadGraphManagerModel { get; init; }
31+
public IGraphModel? ReadGraphModel { get; init; }
3232

33-
public IGraphManagerModel? WriteGraphManagerModel { get; init; }
33+
public IGraphModel? WriteGraphModel { get; init; }
3434

3535
public VaultIoSpeedReporterModel(IProgress<double>? readGraphProgress, IProgress<double>? writeGraphProgress)
3636
{
@@ -70,12 +70,12 @@ private async void UpdateTimer_Elapsed(object? sender, ElapsedEventArgs e)
7070

7171
await ThreadingService.ExecuteOnUiThreadAsync(() =>
7272
{
73-
ReadGraphManagerModel?.AddPoint(new()
73+
ReadGraphModel?.AddPoint(new()
7474
{
7575
Date = now,
7676
High = Convert.ToInt64(Math.Round(ByteSize.FromBytes(_readAmountBeforeFlush).MegaBytes))
7777
});
78-
WriteGraphManagerModel?.AddPoint(new()
78+
WriteGraphModel?.AddPoint(new()
7979
{
8080
Date = now,
8181
High = Convert.ToInt64(Math.Round(ByteSize.FromBytes(_writeAmountBeforeFlush).MegaBytes))
@@ -92,7 +92,6 @@ await ThreadingService.ExecuteOnUiThreadAsync(() =>
9292
if (_updateTimerInterval == 4)
9393
{
9494
CalculateRates();
95-
9695
_updateTimerInterval = 0;
9796
}
9897
}

SecureFolderFS.Backend/Utils/ICanceledFlag.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace SecureFolderFS.Backend.Utils
2+
{
3+
/// <summary>
4+
/// Provides dispatch for notifying the caller whether the event should be forwarded or not.
5+
/// </summary>
6+
public interface IEventDispatchFlag
7+
{
8+
/// <summary>
9+
/// Prevents forwarding of the event.
10+
/// </summary>
11+
void NoForwarding();
12+
}
13+
}

SecureFolderFS.Backend/Utils/IHandledFlag.cs

Lines changed: 0 additions & 9 deletions
This file was deleted.

SecureFolderFS.Backend/ViewModels/Controls/GraphControlViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace SecureFolderFS.Backend.ViewModels.Controls
88
{
9-
public sealed class GraphControlViewModel : ObservableObject, IGraphManagerModel, IProgress<double>
9+
public sealed class GraphControlViewModel : ObservableObject, IGraphModel, IProgress<double>
1010
{
1111
private IThreadingService ThreadingService { get; } = Ioc.Default.GetRequiredService<IThreadingService>();
1212

0 commit comments

Comments
 (0)