Private async method names

This commit is contained in:
ClemensFischer 2025-01-26 22:40:33 +01:00
parent 4335457c54
commit caf47209a3
10 changed files with 23 additions and 23 deletions

View file

@ -9,7 +9,7 @@ namespace MapControl
{ {
public static partial class GeoImage public static partial class GeoImage
{ {
private static Task<GeoBitmap> LoadGeoTiffAsync(string sourcePath) private static Task<GeoBitmap> LoadGeoTiff(string sourcePath)
{ {
throw new InvalidOperationException("GeoTIFF is not supported."); throw new InvalidOperationException("GeoTIFF is not supported.");
} }

View file

@ -9,7 +9,7 @@ namespace MapControl
{ {
public partial class TileImageLoader public partial class TileImageLoader
{ {
private static async Task LoadTileAsync(Tile tile, Func<Task<IImage>> loadImageFunc) private static async Task LoadTileImage(Tile tile, Func<Task<IImage>> loadImageFunc)
{ {
var image = await loadImageFunc().ConfigureAwait(false); var image = await loadImageFunc().ConfigureAwait(false);

View file

@ -92,7 +92,7 @@ namespace MapControl
{ {
try try
{ {
var geoBitmap = await LoadGeoBitmapAsync(sourcePath); var geoBitmap = await LoadGeoBitmap(sourcePath);
if (element is Image image) if (element is Image image)
{ {
@ -122,7 +122,7 @@ namespace MapControl
} }
} }
private static async Task<GeoBitmap> LoadGeoBitmapAsync(string sourcePath) private static async Task<GeoBitmap> LoadGeoBitmap(string sourcePath)
{ {
var ext = Path.GetExtension(sourcePath); var ext = Path.GetExtension(sourcePath);
@ -136,15 +136,15 @@ namespace MapControl
{ {
return new GeoBitmap( return new GeoBitmap(
(BitmapSource)await ImageLoader.LoadImageAsync(sourcePath), (BitmapSource)await ImageLoader.LoadImageAsync(sourcePath),
await ReadWorldFileMatrixAsync(worldFilePath), await ReadWorldFileMatrix(worldFilePath),
null); null);
} }
} }
return await LoadGeoTiffAsync(sourcePath); return await LoadGeoTiff(sourcePath);
} }
private static async Task<Matrix> ReadWorldFileMatrixAsync(string worldFilePath) private static async Task<Matrix> ReadWorldFileMatrix(string worldFilePath)
{ {
using (var fileStream = File.OpenRead(worldFilePath)) using (var fileStream = File.OpenRead(worldFilePath))
using (var streamReader = new StreamReader(fileStream)) using (var streamReader = new StreamReader(fileStream))

View file

@ -75,11 +75,11 @@ namespace MapControl
if (ext == ".kmz") if (ext == ".kmz")
{ {
imageOverlays = await LoadGroundOverlaysFromArchiveAsync(sourcePath); imageOverlays = await LoadGroundOverlaysFromArchive(sourcePath);
} }
else if (ext == ".kml") else if (ext == ".kml")
{ {
imageOverlays = await LoadGroundOverlaysFromFileAsync(sourcePath); imageOverlays = await LoadGroundOverlaysFromFile(sourcePath);
} }
} }
catch (Exception ex) catch (Exception ex)
@ -107,7 +107,7 @@ namespace MapControl
} }
} }
private static async Task<IEnumerable<ImageOverlay>> LoadGroundOverlaysFromArchiveAsync(string archiveFilePath) private static async Task<IEnumerable<ImageOverlay>> LoadGroundOverlaysFromArchive(string archiveFilePath)
{ {
using (var archive = ZipFile.OpenRead(archiveFilePath)) using (var archive = ZipFile.OpenRead(archiveFilePath))
{ {
@ -150,7 +150,7 @@ namespace MapControl
} }
} }
private static async Task<IEnumerable<ImageOverlay>> LoadGroundOverlaysFromFileAsync(string docFilePath) private static async Task<IEnumerable<ImageOverlay>> LoadGroundOverlaysFromFile(string docFilePath)
{ {
docFilePath = FilePath.GetFullPath(docFilePath); docFilePath = FilePath.GetFullPath(docFilePath);

View file

@ -93,7 +93,7 @@ namespace MapControl
try try
{ {
await LoadTileAsync(tile, tileSource, cacheName).ConfigureAwait(false); await LoadTileImage(tile, tileSource, cacheName).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -112,14 +112,14 @@ namespace MapControl
} }
} }
private static async Task LoadTileAsync(Tile tile, TileSource tileSource, string cacheName) private static async Task LoadTileImage(Tile tile, TileSource tileSource, string cacheName)
{ {
// Pass tileSource.LoadImageAsync calls to platform-specific method // Pass tileSource.LoadImageAsync calls to platform-specific method
// LoadTileAsync(Tile, Func<Task<ImageSource>>) for execution on the UI thread in WinUI/UWP. // LoadTileImage(Tile, Func<Task<ImageSource>>) for execution on the UI thread in WinUI and UWP.
if (string.IsNullOrEmpty(cacheName)) if (string.IsNullOrEmpty(cacheName))
{ {
await LoadTileAsync(tile, () => tileSource.LoadImageAsync(tile.Column, tile.Row, tile.ZoomLevel)).ConfigureAwait(false); await LoadTileImage(tile, () => tileSource.LoadImageAsync(tile.Column, tile.Row, tile.ZoomLevel)).ConfigureAwait(false);
} }
else else
{ {
@ -127,17 +127,17 @@ namespace MapControl
if (uri != null) if (uri != null)
{ {
var buffer = await LoadCachedBufferAsync(tile, uri, cacheName).ConfigureAwait(false); var buffer = await LoadCachedBuffer(tile, uri, cacheName).ConfigureAwait(false);
if (buffer != null && buffer.Length > 0) if (buffer != null && buffer.Length > 0)
{ {
await LoadTileAsync(tile, () => tileSource.LoadImageAsync(buffer)).ConfigureAwait(false); await LoadTileImage(tile, () => tileSource.LoadImageAsync(buffer)).ConfigureAwait(false);
} }
} }
} }
} }
private static async Task<byte[]> LoadCachedBufferAsync(Tile tile, Uri uri, string cacheName) private static async Task<byte[]> LoadCachedBuffer(Tile tile, Uri uri, string cacheName)
{ {
byte[] buffer = null; byte[] buffer = null;

View file

@ -11,7 +11,7 @@ namespace MapControl
{ {
public partial class TileImageLoader public partial class TileImageLoader
{ {
private static async Task LoadTileAsync(Tile tile, Func<Task<ImageSource>> loadImageFunc) private static async Task LoadTileImage(Tile tile, Func<Task<ImageSource>> loadImageFunc)
{ {
var tcs = new TaskCompletionSource<object>(); var tcs = new TaskCompletionSource<object>();

View file

@ -13,7 +13,7 @@ namespace MapControl
{ {
public static partial class GeoImage public static partial class GeoImage
{ {
private static Task<GeoBitmap> LoadGeoTiffAsync(string sourcePath) private static Task<GeoBitmap> LoadGeoTiff(string sourcePath)
{ {
return Task.Run(() => return Task.Run(() =>
{ {

View file

@ -10,7 +10,7 @@ namespace MapControl
{ {
public partial class TileImageLoader public partial class TileImageLoader
{ {
private static async Task LoadTileAsync(Tile tile, Func<Task<ImageSource>> loadImageFunc) private static async Task LoadTileImage(Tile tile, Func<Task<ImageSource>> loadImageFunc)
{ {
var image = await loadImageFunc().ConfigureAwait(false); var image = await loadImageFunc().ConfigureAwait(false);

View file

@ -16,7 +16,7 @@ namespace MapControl
{ {
public static partial class GeoImage public static partial class GeoImage
{ {
private static async Task<GeoBitmap> LoadGeoTiffAsync(string sourcePath) private static async Task<GeoBitmap> LoadGeoTiff(string sourcePath)
{ {
BitmapSource bitmap; BitmapSource bitmap;
Matrix transform; Matrix transform;

View file

@ -11,7 +11,7 @@ namespace MapControl
{ {
public partial class TileImageLoader public partial class TileImageLoader
{ {
private static Task LoadTileAsync(Tile tile, Func<Task<ImageSource>> loadImageFunc) private static Task LoadTileImage(Tile tile, Func<Task<ImageSource>> loadImageFunc)
{ {
var tcs = new TaskCompletionSource(); var tcs = new TaskCompletionSource();