2014-04-05 14:53:58 +02:00
|
|
|
|
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
2015-01-20 17:52:02 +01:00
|
|
|
|
// © 2015 Clemens Fischer
|
2014-04-05 14:53:58 +02:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class MapImageLayer
|
|
|
|
|
|
{
|
2014-10-19 21:50:23 +02:00
|
|
|
|
private void ImageUpdated(BitmapSource bitmap)
|
2014-04-05 14:53:58 +02:00
|
|
|
|
{
|
2014-10-19 21:50:23 +02:00
|
|
|
|
if (bitmap != null && !bitmap.IsFrozen && bitmap.IsDownloading)
|
2014-04-05 14:53:58 +02:00
|
|
|
|
{
|
|
|
|
|
|
bitmap.DownloadCompleted += BitmapDownloadCompleted;
|
|
|
|
|
|
bitmap.DownloadFailed += BitmapDownloadFailed;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
BlendImages();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void BitmapDownloadCompleted(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
var bitmap = (BitmapSource)sender;
|
|
|
|
|
|
bitmap.DownloadCompleted -= BitmapDownloadCompleted;
|
|
|
|
|
|
bitmap.DownloadFailed -= BitmapDownloadFailed;
|
|
|
|
|
|
|
|
|
|
|
|
BlendImages();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void BitmapDownloadFailed(object sender, ExceptionEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
var bitmap = (BitmapSource)sender;
|
|
|
|
|
|
bitmap.DownloadCompleted -= BitmapDownloadCompleted;
|
|
|
|
|
|
bitmap.DownloadFailed -= BitmapDownloadFailed;
|
|
|
|
|
|
|
2014-10-19 21:50:23 +02:00
|
|
|
|
var mapImage = (MapImage)Children[currentImageIndex];
|
|
|
|
|
|
mapImage.Source = null;
|
|
|
|
|
|
|
2014-04-05 14:53:58 +02:00
|
|
|
|
BlendImages();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|