diff --git a/MapControl/Shared/ImageFileCache.cs b/MapControl/Shared/ImageFileCache.cs index 0640d458..dc0e6bc7 100644 --- a/MapControl/Shared/ImageFileCache.cs +++ b/MapControl/Shared/ImageFileCache.cs @@ -326,7 +326,7 @@ namespace MapControl.Caching private static byte[] ReadAllBytes(FileInfo file) { - using var stream = file.OpenRead(); + using var stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.Read); var buffer = new byte[stream.Length]; var offset = 0; @@ -340,7 +340,7 @@ namespace MapControl.Caching private static async Task ReadAllBytes(FileInfo file, CancellationToken token) { - using var stream = file.OpenRead(); + using var stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.Read); var buffer = new byte[stream.Length]; var offset = 0; diff --git a/MapControl/Shared/MapPanel.cs b/MapControl/Shared/MapPanel.cs index 2f1e4db2..e2e69c9c 100644 --- a/MapControl/Shared/MapPanel.cs +++ b/MapControl/Shared/MapPanel.cs @@ -1,4 +1,5 @@ -#if WPF +using System.Linq; +#if WPF using System.Windows; using System.Windows.Controls; using System.Windows.Media; @@ -176,7 +177,7 @@ namespace MapControl { availableSize = new Size(double.PositiveInfinity, double.PositiveInfinity); - foreach (FrameworkElement element in Children) + foreach (var element in Children.OfType()) { element.Measure(availableSize); } @@ -188,7 +189,7 @@ namespace MapControl { if (parentMap != null) { - foreach (FrameworkElement element in Children) + foreach (var element in Children.OfType()) { ArrangeChildElement(element, finalSize); } diff --git a/MapControl/Shared/MapTileLayer.cs b/MapControl/Shared/MapTileLayer.cs index c7939c6c..7f7b98e2 100644 --- a/MapControl/Shared/MapTileLayer.cs +++ b/MapControl/Shared/MapTileLayer.cs @@ -103,7 +103,7 @@ namespace MapControl { foreach (var tile in Tiles) { - // Arrange tiles relative to XMin/YMin. + // Arrange tiles relative to TileMatrix.XMin/YMin. // var tileSize = TileSize << (TileMatrix.ZoomLevel - tile.ZoomLevel); var x = tileSize * tile.X - TileSize * TileMatrix.XMin; diff --git a/MapControl/Shared/WmtsTileMatrixLayer.cs b/MapControl/Shared/WmtsTileMatrixLayer.cs index a412032c..d2279e0a 100644 --- a/MapControl/Shared/WmtsTileMatrixLayer.cs +++ b/MapControl/Shared/WmtsTileMatrixLayer.cs @@ -113,7 +113,7 @@ namespace MapControl { foreach (var tile in Tiles) { - // Arrange tiles relative to XMin/YMin. + // Arrange tiles relative to TileMatrix.XMin/YMin. // var tileWidth = WmtsTileMatrix.TileWidth; var tileHeight = WmtsTileMatrix.TileHeight;