-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Further refactorings and restructuring
- Loading branch information
Showing
16 changed files
with
116 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using GlucoseTray.Domain.DisplayResults; | ||
using GlucoseTray.Domain.FetchResults; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace GlucoseTray.Domain; | ||
|
||
public static class DependencyExtensions | ||
{ | ||
public static IServiceCollection RegisterDomainServices(this IServiceCollection services) | ||
{ | ||
services.AddScoped<IRunner, Runner>() | ||
.AddScoped<DebugService, DebugService>() | ||
.AddScoped<AlertService, AlertService>() | ||
.AddScoped<INightscoutService, NightscoutService>() | ||
.AddScoped<IDexcomService, DexcomService>() | ||
.AddScoped<UrlAssembler, UrlAssembler>() | ||
.AddScoped<IGlucoseFetchService, GlucoseFetchService>(); | ||
|
||
return services; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using GlucoseTray.Domain.DisplayResults; | ||
using GlucoseTray.Domain.FetchResults; | ||
|
||
namespace GlucoseTray.Domain; | ||
|
||
public interface IRunner | ||
{ | ||
void Initialize(EventHandler exitHandler); | ||
Task DoWorkAsync(); | ||
void HandleShutdown(Exception? e = null); | ||
} | ||
|
||
public class Runner(IGlucoseFetchService fetchService, IIconService uiService, AlertService alertService, IDialogService dialogService) : IRunner | ||
{ | ||
private readonly IGlucoseFetchService _fetchService = fetchService; | ||
private readonly IIconService _iconService = uiService; | ||
private readonly IDialogService _dialogService = dialogService; | ||
private readonly AlertService _alertService = alertService; | ||
|
||
public void Initialize(EventHandler exitHandler) => _iconService.InitializeTrayIcon(exitHandler); | ||
|
||
public async Task DoWorkAsync() | ||
{ | ||
GlucoseResult currentGlucoseResult = await _fetchService.GetLatestReadingsAsync(); | ||
_iconService.CreateIcon(currentGlucoseResult); | ||
_alertService.AlertNotification(currentGlucoseResult); | ||
} | ||
|
||
public void HandleShutdown(Exception? e = null) | ||
{ | ||
if (e is not null) | ||
_dialogService.ShowErrorAlert($"ERROR: {e}", "ERROR"); | ||
_iconService.DisposeTrayIcon(); | ||
} | ||
} |
13 changes: 9 additions & 4 deletions
13
GlucoseTray/Services/FileService.cs → GlucoseTray.Infrastructure/FileService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
GlucoseTray/Services/UiService.cs → GlucoseTray/DisplayResults/DialogService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
GlucoseTray/Models/NightScoutStatus.cs → ...eTray/GlucoseSettings/NightScoutStatus.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
GlucoseTray/Settings/SettingsProxy.cs → GlucoseTray/GlucoseSettings/SettingsProxy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
global using GlucoseTray.Models; | ||
global using GlucoseTray.Services; | ||
global using System; | ||
global using System; | ||
global using System.Collections.Generic; | ||
global using System.Threading.Tasks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"appsettings": { | ||
"Version": "15.1.6", | ||
"Version": "15.1.7", | ||
"Url": "https://github.com/Delubear/GlucoseTray" | ||
} | ||
} |