mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 06:26:41 +00:00
Reverted image download cancellation
This commit is contained in:
parent
6f82f8012a
commit
2cf8636f4c
7 changed files with 86 additions and 131 deletions
|
|
@ -4,7 +4,6 @@ using Avalonia.Media.Imaging;
|
|||
using Avalonia.Platform;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MapControl
|
||||
|
|
@ -39,18 +38,17 @@ namespace MapControl
|
|||
}
|
||||
}
|
||||
|
||||
internal static async Task<IImage> LoadMergedImageAsync(Uri uri1, Uri uri2, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
internal static async Task<IImage> LoadMergedImageAsync(Uri uri1, Uri uri2, IProgress<double> progress)
|
||||
{
|
||||
WriteableBitmap mergedBitmap = null;
|
||||
var p1 = 0d;
|
||||
var p2 = 0d;
|
||||
|
||||
var images = await Task.WhenAll(
|
||||
LoadImageAsync(uri1, new Progress<double>(p => { p1 = p; progress.Report((p1 + p2) / 2d); }), cancellationToken),
|
||||
LoadImageAsync(uri2, new Progress<double>(p => { p2 = p; progress.Report((p1 + p2) / 2d); }), cancellationToken));
|
||||
LoadImageAsync(uri1, new Progress<double>(p => { p1 = p; progress.Report((p1 + p2) / 2d); })),
|
||||
LoadImageAsync(uri2, new Progress<double>(p => { p2 = p; progress.Report((p1 + p2) / 2d); })));
|
||||
|
||||
if (!cancellationToken.IsCancellationRequested &&
|
||||
images.Length == 2 &&
|
||||
if (images.Length == 2 &&
|
||||
images[0] is Bitmap bitmap1 &&
|
||||
images[1] is Bitmap bitmap2 &&
|
||||
bitmap1.PixelSize.Height == bitmap2.PixelSize.Height &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue