mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-05-07 13:37:47 +00:00
Version 4.12.2 Fixed local file handling for UWP. All relative paths relative to ms-appx:
This commit is contained in:
parent
26bf0b5005
commit
c28387f87c
14 changed files with 172 additions and 192 deletions
|
|
@ -31,28 +31,18 @@ namespace MapControl
|
|||
{
|
||||
await stream.WriteAsync(buffer.AsBuffer());
|
||||
stream.Seek(0);
|
||||
|
||||
return await LoadImageAsync(stream);
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task<ImageSource> LoadImageAsync(IHttpContent content)
|
||||
{
|
||||
using (var stream = new InMemoryRandomAccessStream())
|
||||
{
|
||||
await content.WriteToStreamAsync(stream);
|
||||
stream.Seek(0);
|
||||
return await LoadImageAsync(stream);
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task<ImageSource> LoadLocalImageAsync(Uri uri)
|
||||
public static async Task<ImageSource> LoadImageAsync(string path)
|
||||
{
|
||||
ImageSource image = null;
|
||||
var path = uri.IsAbsoluteUri ? uri.LocalPath : uri.OriginalString;
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
var file = await StorageFile.GetFileFromPathAsync(path);
|
||||
var file = await StorageFile.GetFileFromPathAsync(Path.GetFullPath(path));
|
||||
|
||||
using (var stream = await file.OpenReadAsync())
|
||||
{
|
||||
|
|
@ -63,6 +53,17 @@ namespace MapControl
|
|||
return image;
|
||||
}
|
||||
|
||||
private static async Task<ImageSource> LoadImageAsync(IHttpContent content)
|
||||
{
|
||||
using (var stream = new InMemoryRandomAccessStream())
|
||||
{
|
||||
await content.WriteToStreamAsync(stream);
|
||||
stream.Seek(0);
|
||||
|
||||
return await LoadImageAsync(stream);
|
||||
}
|
||||
}
|
||||
|
||||
internal class HttpBufferResponse
|
||||
{
|
||||
public readonly IBuffer Buffer;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue