using Azaion.Common.Services; using GMap.NET; using GMap.NET.WindowsPresentation; using MediatR; namespace Azaion.Annotator.Controls; public class MapMatcherEventHandler(MapMatcher mapMatcher) : INotificationHandler { public Task Handle(GPSMatcherResultEvent result, CancellationToken cancellationToken) { mapMatcher.Dispatcher.Invoke(() => { var marker = new GMapMarker(new PointLatLng(result.Latitude, result.Longitude)); var ann = mapMatcher.Annotations[result.Index]; marker.Shape = new CircleVisual(marker, System.Windows.Media.Brushes.Blue) { Text = result.Image }; mapMatcher.SatelliteMap.Markers.Add(marker); ann.Lat = result.Latitude; ann.Lon = result.Longitude; mapMatcher.SatelliteMap.Position = new PointLatLng(result.Latitude, result.Longitude); mapMatcher.SatelliteMap.ZoomAndCenterMarkers(null); }); return Task.CompletedTask; } }