MapMenuItems

This commit is contained in:
ClemensFischer 2025-09-06 12:25:47 +02:00
parent ac97d2f7ed
commit acecccf381
2 changed files with 25 additions and 27 deletions

View file

@ -27,28 +27,23 @@ namespace MapControl.UiTools
protected override bool GetIsChecked(MapBase map)
{
return map.MapProjection.CrsId == MapProjection;
return map.MapProjection.ToString() == MapProjection;
}
public override Task Execute(MapBase map)
{
bool success = true;
if (map.MapProjection.CrsId != MapProjection)
if (!GetIsChecked(map))
{
try
{
map.MapProjection = MapProjectionFactory.Instance.GetProjection(MapProjection);
map.MapProjection = MapControl.MapProjection.Parse(MapProjection);
}
catch (Exception ex)
{
Debug.WriteLine($"{nameof(MapProjectionFactory)}: {ex.Message}");
success = false;
Debug.WriteLine($"MapProjection.Parse: {ex.Message}");
}
}
IsChecked = success;
return Task.CompletedTask;
}
}