diff --git a/Azaion.Annotator/AnnotatorEventHandler.cs b/Azaion.Annotator/AnnotatorEventHandler.cs index 9879ada..c316b17 100644 --- a/Azaion.Annotator/AnnotatorEventHandler.cs +++ b/Azaion.Annotator/AnnotatorEventHandler.cs @@ -376,8 +376,7 @@ public class AnnotatorEventHandler( mainWindow.Dispatcher.Invoke(() => { mainWindow.StatusHelp.Text = e.Text; - if (e.Color.HasValue) - mainWindow.StatusHelp.Foreground = new SolidColorBrush(e.Color.Value); + mainWindow.StatusHelp.Foreground = e.IsError ? Brushes.Red : Brushes.White; }); return Task.CompletedTask; } @@ -389,10 +388,7 @@ public class AnnotatorEventHandler( var mapMatcher = mainWindow.MapMatcherComponent; var marker = new GMapMarker(new PointLatLng(e.Latitude, e.Longitude)); var ann = mapMatcher.Annotations[e.Index]; - marker.Shape = new CircleVisual(marker, Brushes.Blue) - { - Text = e.Image - }; + marker.Shape = new CircleVisual(marker, size: 14, text: e.Image, background: Brushes.Blue); mapMatcher.SatelliteMap.Markers.Add(marker); ann.Lat = e.Latitude; ann.Lon = e.Longitude; diff --git a/Azaion.Annotator/Controls/CircleVisual.cs b/Azaion.Annotator/Controls/CircleVisual.cs index 48db328..0d6ae2d 100644 --- a/Azaion.Annotator/Controls/CircleVisual.cs +++ b/Azaion.Annotator/Controls/CircleVisual.cs @@ -11,7 +11,7 @@ namespace Azaion.Annotator.Controls { public readonly GMapMarker Marker; - public CircleVisual(GMapMarker m, Brush background) + public CircleVisual(GMapMarker m, int size, string text, Brush background) { ShadowEffect = new DropShadowEffect(); Marker = m; @@ -22,14 +22,14 @@ namespace Azaion.Annotator.Controls MouseLeave += CircleVisual_MouseLeave; Loaded += OnLoaded; - Text = "?"; + Text = text; StrokeArrow.EndLineCap = PenLineCap.Triangle; StrokeArrow.LineJoin = PenLineJoin.Round; RenderTransform = _scale; - Width = Height = 22; + Width = Height = size; FontSize = Width / 1.55; Background = background; diff --git a/Azaion.Common/Events/SetStatusTextEvent.cs b/Azaion.Common/Events/SetStatusTextEvent.cs index 8481c81..7881f77 100644 --- a/Azaion.Common/Events/SetStatusTextEvent.cs +++ b/Azaion.Common/Events/SetStatusTextEvent.cs @@ -1,10 +1,9 @@ -using System.Windows.Media; using MediatR; namespace Azaion.Common.Events; -public class SetStatusTextEvent(string text, Color? color = null) : INotification +public class SetStatusTextEvent(string text, bool isError = false) : INotification { public string Text { get; set; } = text; - public Color? Color { get; set; } = color; + public bool IsError { get; set; } = isError; } \ No newline at end of file diff --git a/Azaion.Common/Services/GPSMatcherService.cs b/Azaion.Common/Services/GPSMatcherService.cs index 51b91d2..29b0d98 100644 --- a/Azaion.Common/Services/GPSMatcherService.cs +++ b/Azaion.Common/Services/GPSMatcherService.cs @@ -65,7 +65,7 @@ public class GpsMatcherService(IGpsMatcherClient gpsMatcherClient, ISatelliteDow .ToDictionary(x => x.Filename, x => x.Index); await satelliteTileDownloader.GetTiles(_currentLat, _currentLon, SATELLITE_RADIUS_M, ZOOM_LEVEL, _detectToken); - gpsMatcherClient.StartMatching(new StartMatchingEvent + await gpsMatcherClient.StartMatching(new StartMatchingEvent { ImagesCount = POINTS_COUNT, Latitude = _currentLat, diff --git a/Azaion.Common/Services/GpsMatcherClient.cs b/Azaion.Common/Services/GpsMatcherClient.cs index ab0a4d9..0ed3c15 100644 --- a/Azaion.Common/Services/GpsMatcherClient.cs +++ b/Azaion.Common/Services/GpsMatcherClient.cs @@ -1,5 +1,6 @@ using System.Diagnostics; using System.IO; +using Azaion.Common.Events; using Azaion.CommonSecurity; using Azaion.CommonSecurity.DTO; using MediatR; @@ -12,7 +13,7 @@ namespace Azaion.Common.Services; public interface IGpsMatcherClient : IDisposable { - void StartMatching(StartMatchingEvent startEvent); + Task StartMatching(StartMatchingEvent startEvent); void Stop(); } @@ -121,9 +122,15 @@ public class GpsMatcherClient : IGpsMatcherClient } } - public void StartMatching(StartMatchingEvent e) + public async Task StartMatching(StartMatchingEvent e) { _requestSocket.SendFrame(e.ToString()); + _requestSocket.TryReceiveFrameString(TimeSpan.FromMilliseconds(300), out var response); + if (response != "OK") + { + _logger.LogError(response); + await _mediator.Publish(new SetStatusTextEvent(response, true)); + } } public void Stop() => _requestSocket.SendFrame("STOP"); diff --git a/Azaion.Suite/Azaion.Suite.csproj b/Azaion.Suite/Azaion.Suite.csproj index cde203f..0a1e040 100644 --- a/Azaion.Suite/Azaion.Suite.csproj +++ b/Azaion.Suite/Azaion.Suite.csproj @@ -33,8 +33,8 @@ - - + + @@ -62,8 +62,8 @@ - - + +