mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Added Tile.SetImageAsync
This commit is contained in:
parent
772549c109
commit
9ebc88204b
4 changed files with 42 additions and 40 deletions
|
|
@ -6,11 +6,17 @@ using System;
|
|||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace MapControl
|
||||
{
|
||||
public partial class Tile
|
||||
{
|
||||
public DispatcherOperation SetImageAsync(ImageSource image)
|
||||
{
|
||||
return Image.Dispatcher.InvokeAsync(() => SetImage(image));
|
||||
}
|
||||
|
||||
public void SetImage(ImageSource image, bool fadeIn = true)
|
||||
{
|
||||
Pending = false;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace MapControl
|
|||
{
|
||||
var image = await ImageLoader.LoadImageAsync(buffer).ConfigureAwait(false);
|
||||
|
||||
await tile.Image.Dispatcher.InvokeAsync(() => tile.SetImage(image));
|
||||
await tile.SetImageAsync(image);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ namespace MapControl
|
|||
{
|
||||
var image = await tileSource.LoadImageAsync(tile.XIndex, tile.Y, tile.ZoomLevel).ConfigureAwait(false);
|
||||
|
||||
await tile.Image.Dispatcher.InvokeAsync(() => tile.SetImage(image));
|
||||
await tile.SetImageAsync(image);
|
||||
}
|
||||
|
||||
private static Task<ImageCacheItem> GetCacheAsync(string cacheKey)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue