mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Update MapOverlaysPanel.cs
This commit is contained in:
parent
e8aec18323
commit
1f8164e82d
|
|
@ -26,7 +26,7 @@ namespace MapControl
|
|||
{
|
||||
public static readonly DependencyProperty SourcePathsProperty =
|
||||
DependencyPropertyHelper.Register<MapOverlaysPanel, IEnumerable<string>>(nameof(SourcePaths), null,
|
||||
async (control, oldValue, newValue) => await control.SourcePathsPropertyChangedAsync(oldValue, newValue));
|
||||
async (control, oldValue, newValue) => await control.SourcePathsPropertyChanged(oldValue, newValue));
|
||||
|
||||
public IEnumerable<string> SourcePaths
|
||||
{
|
||||
|
|
@ -34,7 +34,7 @@ namespace MapControl
|
|||
set => SetValue(SourcePathsProperty, value);
|
||||
}
|
||||
|
||||
private async Task SourcePathsPropertyChangedAsync(IEnumerable<string> oldSourcePaths, IEnumerable<string> newSourcePaths)
|
||||
private async Task SourcePathsPropertyChanged(IEnumerable<string> oldSourcePaths, IEnumerable<string> newSourcePaths)
|
||||
{
|
||||
Children.Clear();
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ namespace MapControl
|
|||
newCollection.CollectionChanged += SourcePathsCollectionChanged;
|
||||
}
|
||||
|
||||
await AddOverlaysAsync(0, newSourcePaths);
|
||||
await AddOverlays(0, newSourcePaths);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ namespace MapControl
|
|||
switch (args.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
await AddOverlaysAsync(args.NewStartingIndex, args.NewItems.Cast<string>());
|
||||
await AddOverlays(args.NewStartingIndex, args.NewItems.Cast<string>());
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
|
|
@ -68,21 +68,21 @@ namespace MapControl
|
|||
|
||||
case NotifyCollectionChangedAction.Move:
|
||||
RemoveOverlays(args.OldStartingIndex, args.OldItems.Count);
|
||||
await AddOverlaysAsync(args.NewStartingIndex, args.NewItems.Cast<string>());
|
||||
await AddOverlays(args.NewStartingIndex, args.NewItems.Cast<string>());
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Replace:
|
||||
await ReplaceOverlaysAsync(args.NewStartingIndex, args.NewItems.Cast<string>());
|
||||
await ReplaceOverlays(args.NewStartingIndex, args.NewItems.Cast<string>());
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Reset:
|
||||
Children.Clear();
|
||||
await AddOverlaysAsync(0, SourcePaths);
|
||||
await AddOverlays(0, SourcePaths);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task AddOverlaysAsync(int index, IEnumerable<string> sourcePaths)
|
||||
private async Task AddOverlays(int index, IEnumerable<string> sourcePaths)
|
||||
{
|
||||
foreach (var sourcePath in sourcePaths)
|
||||
{
|
||||
|
|
@ -90,7 +90,7 @@ namespace MapControl
|
|||
}
|
||||
}
|
||||
|
||||
private async Task ReplaceOverlaysAsync(int index, IEnumerable<string> sourcePaths)
|
||||
private async Task ReplaceOverlays(int index, IEnumerable<string> sourcePaths)
|
||||
{
|
||||
foreach (var sourcePath in sourcePaths)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue