update AI initializing

rework AIAvailabilityStatus events to mediatr
This commit is contained in:
Oleksandr Bezdieniezhnykh
2025-09-01 20:12:13 +03:00
parent d1ce9d9365
commit 067f02cc63
23 changed files with 282 additions and 192 deletions
+13 -1
View File
@@ -12,6 +12,7 @@ using Azaion.Common.DTO.Config;
using Azaion.Common.Events;
using Azaion.Common.Extensions;
using Azaion.Common.Services;
using Azaion.Common.Services.Inference;
using GMap.NET;
using GMap.NET.WindowsPresentation;
using LibVLCSharp.Shared;
@@ -43,7 +44,8 @@ public class AnnotatorEventHandler(
INotificationHandler<AnnotationsDeletedEvent>,
INotificationHandler<AnnotationAddedEvent>,
INotificationHandler<SetStatusTextEvent>,
INotificationHandler<GPSMatcherResultProcessedEvent>
INotificationHandler<GPSMatcherResultProcessedEvent>,
INotificationHandler<AIAvailabilityStatusEvent>
{
private const int STEP = 20;
private const int LARGE_STEP = 5000;
@@ -472,4 +474,14 @@ public class AnnotatorEventHandler(
map.SatelliteMap.Position = pointLatLon;
map.SatelliteMap.ZoomAndCenterMarkers(null);
}
public async Task Handle(AIAvailabilityStatusEvent e, CancellationToken cancellationToken)
{
mainWindow.Dispatcher.Invoke(() =>
{
logger.LogInformation(e.ToString());
mainWindow.AIDetectBtn.IsEnabled = e.Status == AIAvailabilityEnum.Enabled;
mainWindow.StatusHelp.Text = e.ToString();
});
}
}