Version 4.12.2 Fixed local file handling for UWP. All relative paths relative to ms-appx:

This commit is contained in:
ClemensF 2019-06-15 01:39:07 +02:00
parent 26bf0b5005
commit c28387f87c
14 changed files with 172 additions and 192 deletions

View file

@ -32,7 +32,7 @@ namespace MapControl
{
if (!uri.IsAbsoluteUri || uri.Scheme == "file")
{
image = await LoadLocalImageAsync(uri);
image = await LoadImageAsync(uri.IsAbsoluteUri ? uri.LocalPath : uri.OriginalString);
}
else if (uri.Scheme == "http" || uri.Scheme == "https")
{

View file

@ -230,13 +230,13 @@ namespace MapControl
UpdateBoundingBox();
ImageSource imageSource = null;
ImageSource image = null;
if (BoundingBox != null)
{
try
{
imageSource = await GetImageAsync();
image = await GetImageAsync();
}
catch (Exception ex)
{
@ -244,7 +244,7 @@ namespace MapControl
}
}
SwapImages(imageSource);
SwapImages(image);
updateInProgress = false;
}
@ -321,7 +321,7 @@ namespace MapControl
}
}
private void SwapImages(ImageSource imageSource)
private void SwapImages(ImageSource image)
{
var topImage = (Image)Children[0];
var bottomImage = (Image)Children[1];
@ -329,7 +329,7 @@ namespace MapControl
Children.RemoveAt(0);
Children.Insert(1, topImage);
topImage.Source = imageSource;
topImage.Source = image;
SetBoundingBox(topImage, BoundingBox?.Clone());
topImage.BeginAnimation(OpacityProperty, new DoubleAnimation

View file

@ -6,7 +6,6 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@ -57,7 +56,7 @@ namespace MapControl
/// If the UriFormat of TileSource starts with "http" and SourceName is a non-empty string,
/// tile images will be cached in the TileImageLoader's Cache.
/// </summary>
public async void LoadTilesAsync(IEnumerable<Tile> tiles)
public void LoadTilesAsync(IEnumerable<Tile> tiles)
{
tileQueue.Clear();
tileQueue.Enqueue(tiles);
@ -68,9 +67,10 @@ namespace MapControl
{
Interlocked.Add(ref taskCount, newTasks);
await Task
.WhenAll(Enumerable.Range(0, newTasks).Select(n => LoadTilesFromQueueAsync()))
.ConfigureAwait(false);
while (--newTasks >= 0)
{
Task.Run(() => LoadTilesFromQueueAsync());
}
}
}

View file

@ -119,9 +119,9 @@ namespace MapControl
protected override async Task<ImageSource> GetImageAsync()
{
var imageUri = GetImageUri();
var uri = GetImageUri();
return imageUri != null ? await ImageLoader.LoadImageAsync(imageUri) : null;
return uri != null ? await ImageLoader.LoadImageAsync(uri) : null;
}
/// <summary>