mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Version 4.1.
This commit is contained in:
parent
526384170c
commit
61d06b4924
|
|
@ -7,7 +7,6 @@ using System.Collections.Concurrent;
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#if WINDOWS_UWP
|
||||
|
|
@ -73,7 +72,7 @@ namespace MapControl
|
|||
{
|
||||
pendingTiles.PushRange(tiles.Reverse().ToArray());
|
||||
|
||||
while (taskCount < Math.Min(pendingTiles.Count, ServicePointManager.DefaultConnectionLimit))
|
||||
while (taskCount < Math.Min(pendingTiles.Count, DefaultConnectionLimit))
|
||||
{
|
||||
Interlocked.Increment(ref taskCount);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,13 +17,18 @@ namespace MapControl
|
|||
/// <summary>
|
||||
/// Default StorageFolder where an IImageCache instance may save cached data.
|
||||
/// </summary>
|
||||
public static readonly StorageFolder DefaultCacheFolder = ApplicationData.Current.TemporaryFolder;
|
||||
public static StorageFolder DefaultCacheFolder { get; } = ApplicationData.Current.TemporaryFolder;
|
||||
|
||||
/// <summary>
|
||||
/// The IImageCache implementation used to cache tile images. The default is null.
|
||||
/// </summary>
|
||||
public static Caching.IImageCache Cache { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum number of concurrent connections.
|
||||
/// </summary>
|
||||
public static int DefaultConnectionLimit { get; set; } = 2;
|
||||
|
||||
private async Task LoadTileImageAsync(Tile tile, Uri uri, string cacheKey)
|
||||
{
|
||||
var cacheItem = await Cache.GetAsync(cacheKey);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Runtime.Caching;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -17,7 +18,7 @@ namespace MapControl
|
|||
/// <summary>
|
||||
/// Default folder path where an ObjectCache instance may save cached data.
|
||||
/// </summary>
|
||||
public static readonly string DefaultCacheFolder =
|
||||
public static string DefaultCacheFolder { get; } =
|
||||
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache");
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -25,6 +26,11 @@ namespace MapControl
|
|||
/// </summary>
|
||||
public static ObjectCache Cache { get; set; } = MemoryCache.Default;
|
||||
|
||||
private static int DefaultConnectionLimit
|
||||
{
|
||||
get { return ServicePointManager.DefaultConnectionLimit; }
|
||||
}
|
||||
|
||||
private async Task LoadTileImageAsync(Tile tile, Uri uri, string cacheKey)
|
||||
{
|
||||
DateTime expiration;
|
||||
|
|
|
|||
Loading…
Reference in a new issue