mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Version 4.10.0: Simplified TileImageLoader.
This commit is contained in:
parent
be3a247064
commit
bbd952b955
|
|
@ -77,9 +77,9 @@ namespace MapControl
|
||||||
loadFunc = tile => LoadTileImageAsync(tile, tileSource);
|
loadFunc = tile => LoadTileImageAsync(tile, tileSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
var maxTasks = Math.Min(pendingTiles.Count, MaxLoadTasks);
|
var newTasks = Math.Min(pendingTiles.Count, MaxLoadTasks) - taskCount;
|
||||||
|
|
||||||
while (taskCount < maxTasks)
|
while (--newTasks >= 0)
|
||||||
{
|
{
|
||||||
Interlocked.Increment(ref taskCount);
|
Interlocked.Increment(ref taskCount);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,20 +5,20 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
#pragma warning disable CS1998 // async method lacks await operators and will run synchronously
|
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
{
|
{
|
||||||
public class XmlDocument : System.Xml.XmlDocument
|
public class XmlDocument : System.Xml.XmlDocument
|
||||||
{
|
{
|
||||||
public static Task<XmlDocument> LoadFromUriAsync(Uri uri)
|
public static XmlDocument LoadFromUri(Uri uri)
|
||||||
{
|
|
||||||
return Task.Run(async () => // without async, debugger may stop on unhandled exception from XmlDocument.Load
|
|
||||||
{
|
{
|
||||||
var document = new XmlDocument();
|
var document = new XmlDocument();
|
||||||
document.Load(uri.ToString());
|
document.Load(uri.ToString());
|
||||||
return document;
|
return document;
|
||||||
});
|
}
|
||||||
|
|
||||||
|
public static Task<XmlDocument> LoadFromUriAsync(Uri uri)
|
||||||
|
{
|
||||||
|
return Task.Run(() => LoadFromUri(uri));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue