mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Update MapLayerMenuItem.cs
This commit is contained in:
parent
ce8618e922
commit
d23db23fbc
|
|
@ -38,10 +38,7 @@ namespace MapControl.UiTools
|
|||
|
||||
public override async Task Execute(MapBase map)
|
||||
{
|
||||
if (MapLayer == null)
|
||||
{
|
||||
MapLayer = await MapLayerFactory?.Invoke();
|
||||
}
|
||||
MapLayer ??= await MapLayerFactory?.Invoke();
|
||||
|
||||
if (MapLayer != null)
|
||||
{
|
||||
|
|
@ -52,14 +49,31 @@ namespace MapControl.UiTools
|
|||
|
||||
public class MapOverlayMenuItem : MapLayerMenuItem
|
||||
{
|
||||
private string sourcePath;
|
||||
|
||||
public string SourcePath
|
||||
{
|
||||
get => sourcePath;
|
||||
set
|
||||
{
|
||||
sourcePath = value;
|
||||
|
||||
if (sourcePath.EndsWith(".kmz") || sourcePath.EndsWith(".kml"))
|
||||
{
|
||||
MapLayerFactory = async () => await GroundOverlay.CreateAsync(sourcePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
MapLayerFactory = async () => await GeoImage.CreateAsync(sourcePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int InsertOrder { get; set; }
|
||||
|
||||
public override async Task Execute(MapBase map)
|
||||
{
|
||||
if (MapLayer == null)
|
||||
{
|
||||
MapLayer = await MapLayerFactory?.Invoke();
|
||||
}
|
||||
MapLayer ??= await MapLayerFactory?.Invoke();
|
||||
|
||||
if (MapLayer != null)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue