mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Remove Task.Run in ImageLoader.LoadImageAsync
This commit is contained in:
parent
edcdeb09c1
commit
f03a627a86
|
|
@ -32,12 +32,10 @@ namespace MapControl
|
|||
return Task.FromResult<IImage>(null);
|
||||
}
|
||||
|
||||
return Task.Run(() =>
|
||||
using (var stream = File.OpenRead(path))
|
||||
{
|
||||
using var stream = File.OpenRead(path);
|
||||
|
||||
return LoadImage(stream);
|
||||
});
|
||||
return LoadImageAsync(stream);
|
||||
}
|
||||
}
|
||||
|
||||
internal static async Task<IImage> LoadMergedImageAsync(Uri uri1, Uri uri2, IProgress<double> progress)
|
||||
|
|
|
|||
|
|
@ -132,12 +132,11 @@ namespace MapControl
|
|||
var file = Path.GetFileNameWithoutExtension(sourcePath);
|
||||
var worldFilePath = Path.Combine(dir, file + ext.Remove(2, 1) + "w");
|
||||
|
||||
if (File.Exists(worldFilePath))
|
||||
if (await ImageLoader.LoadImageAsync(sourcePath) is BitmapSource bitmap)
|
||||
{
|
||||
return new GeoBitmap(
|
||||
(BitmapSource)await ImageLoader.LoadImageAsync(sourcePath),
|
||||
await ReadWorldFileMatrix(worldFilePath),
|
||||
null);
|
||||
var transform = await ReadWorldFileMatrix(worldFilePath);
|
||||
|
||||
return new GeoBitmap(bitmap, transform, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,13 +43,10 @@ namespace MapControl
|
|||
return Task.FromResult<ImageSource>(null);
|
||||
}
|
||||
|
||||
return Task.Run(() =>
|
||||
using (var stream = File.OpenRead(path))
|
||||
{
|
||||
using (var stream = File.OpenRead(path))
|
||||
{
|
||||
return LoadImage(stream);
|
||||
}
|
||||
});
|
||||
return LoadImageAsync(stream);
|
||||
}
|
||||
}
|
||||
|
||||
internal static async Task<ImageSource> LoadMergedImageAsync(Uri uri1, Uri uri2, IProgress<double> progress)
|
||||
|
|
|
|||
Loading…
Reference in a new issue