mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-05-07 13:37:47 +00:00
File scoped namespaces
This commit is contained in:
parent
c14377f976
commit
65aba44af6
152 changed files with 11962 additions and 12115 deletions
|
|
@ -12,37 +12,36 @@ using Microsoft.UI.Xaml.Media;
|
|||
using Microsoft.UI.Xaml.Media.Imaging;
|
||||
#endif
|
||||
|
||||
namespace MapControl.MapsforgeTiles
|
||||
namespace MapControl.MapsforgeTiles;
|
||||
|
||||
public partial class MapsforgeTileSource
|
||||
{
|
||||
public partial class MapsforgeTileSource
|
||||
public override async Task<ImageSource> LoadImageAsync(int zoomLevel, int column, int row)
|
||||
{
|
||||
public override async Task<ImageSource> LoadImageAsync(int zoomLevel, int column, int row)
|
||||
ImageSource image = null;
|
||||
var bitmap = new WriteableBitmap(TileSize, TileSize);
|
||||
using var stream = bitmap.PixelBuffer.AsStream();
|
||||
|
||||
try
|
||||
{
|
||||
ImageSource image = null;
|
||||
var bitmap = new WriteableBitmap(TileSize, TileSize);
|
||||
using var stream = bitmap.PixelBuffer.AsStream();
|
||||
|
||||
try
|
||||
// Run a Task because in WinUI/UWP LoadImageAsync is called in the UI thread.
|
||||
//
|
||||
await Task.Run(() =>
|
||||
{
|
||||
// Run a Task because in WinUI/UWP LoadImageAsync is called in the UI thread.
|
||||
//
|
||||
await Task.Run(() =>
|
||||
var pixels = RenderTile(zoomLevel, column, row);
|
||||
|
||||
if (pixels != null)
|
||||
{
|
||||
var pixels = RenderTile(zoomLevel, column, row);
|
||||
|
||||
if (pixels != null)
|
||||
{
|
||||
stream.Write(MemoryMarshal.AsBytes(pixels.AsSpan()));
|
||||
image = bitmap;
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger?.LogError(ex, "LoadImageAsync");
|
||||
}
|
||||
|
||||
return image;
|
||||
stream.Write(MemoryMarshal.AsBytes(pixels.AsSpan()));
|
||||
image = bitmap;
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger?.LogError(ex, "LoadImageAsync");
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue