mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Update GroundOverlay.cs
This commit is contained in:
parent
9a3da275c0
commit
ee450e1a56
|
|
@ -162,22 +162,24 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
var imageOverlays = ReadImageOverlays(document);
|
var imageOverlays = ReadImageOverlays(document);
|
||||||
|
|
||||||
var semaphore = new SemaphoreSlim(MaxLoadTasks);
|
using (var semaphore = new SemaphoreSlim(MaxLoadTasks))
|
||||||
|
|
||||||
var tasks = imageOverlays.Select(async imageOverlay =>
|
|
||||||
{
|
{
|
||||||
await semaphore.WaitAsync();
|
var tasks = imageOverlays.Select(
|
||||||
try
|
async imageOverlay =>
|
||||||
{
|
{
|
||||||
await loadFunc(imageOverlay); // no more than MaxLoadTasks parallel executions here
|
await semaphore.WaitAsync();
|
||||||
}
|
try
|
||||||
finally
|
{
|
||||||
{
|
await loadFunc(imageOverlay); // no more than MaxLoadTasks parallel executions here
|
||||||
semaphore.Release();
|
}
|
||||||
}
|
finally
|
||||||
});
|
{
|
||||||
|
semaphore.Release();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
await Task.WhenAll(tasks);
|
await Task.WhenAll(tasks);
|
||||||
|
}
|
||||||
|
|
||||||
return imageOverlays;
|
return imageOverlays;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue