diff --git a/FileDbCache/UWP/Properties/AssemblyInfo.cs b/FileDbCache/UWP/Properties/AssemblyInfo.cs index 88b6ae88..1e68a6d6 100644 --- a/FileDbCache/UWP/Properties/AssemblyInfo.cs +++ b/FileDbCache/UWP/Properties/AssemblyInfo.cs @@ -6,8 +6,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © 2022 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("7.2.1")] -[assembly: AssemblyFileVersion("7.2.1")] +[assembly: AssemblyVersion("7.3.0")] +[assembly: AssemblyFileVersion("7.3.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/FileDbCache/WPF/FileDbCache.WPF.csproj b/FileDbCache/WPF/FileDbCache.WPF.csproj index 74117c9d..3b636e09 100644 --- a/FileDbCache/WPF/FileDbCache.WPF.csproj +++ b/FileDbCache/WPF/FileDbCache.WPF.csproj @@ -5,7 +5,7 @@ MapControl.Caching XAML Map Control FileDbCache Library for WPF XAML Map Control - 7.2.1 + 7.3.0 Clemens Fischer Copyright © 2022 Clemens Fischer true diff --git a/FileDbCache/WinUI/FileDbCache.WinUI.csproj b/FileDbCache/WinUI/FileDbCache.WinUI.csproj index 0b57589b..3bfaaa35 100644 --- a/FileDbCache/WinUI/FileDbCache.WinUI.csproj +++ b/FileDbCache/WinUI/FileDbCache.WinUI.csproj @@ -7,7 +7,7 @@ MapControl.Caching XAML Map Control FileDbCache Library for WinUI XAML Map Control - 7.2.1 + 7.3.0 Clemens Fischer Copyright © 2022 Clemens Fischer true diff --git a/MBTiles/UWP/Properties/AssemblyInfo.cs b/MBTiles/UWP/Properties/AssemblyInfo.cs index 4ad641ef..36499c37 100644 --- a/MBTiles/UWP/Properties/AssemblyInfo.cs +++ b/MBTiles/UWP/Properties/AssemblyInfo.cs @@ -6,8 +6,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © 2022 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("7.2.1")] -[assembly: AssemblyFileVersion("7.2.1")] +[assembly: AssemblyVersion("7.3.0")] +[assembly: AssemblyFileVersion("7.3.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MBTiles/WPF/MBTiles.WPF.csproj b/MBTiles/WPF/MBTiles.WPF.csproj index 0a47393c..44af15b5 100644 --- a/MBTiles/WPF/MBTiles.WPF.csproj +++ b/MBTiles/WPF/MBTiles.WPF.csproj @@ -5,7 +5,7 @@ MapControl.MBTiles XAML Map Control MBTiles Library for WPF XAML Map Control - 7.2.1 + 7.3.0 Clemens Fischer Copyright © 2022 Clemens Fischer true diff --git a/MBTiles/WinUI/MBTiles.WinUI.csproj b/MBTiles/WinUI/MBTiles.WinUI.csproj index 93b4ef0d..39f633e8 100644 --- a/MBTiles/WinUI/MBTiles.WinUI.csproj +++ b/MBTiles/WinUI/MBTiles.WinUI.csproj @@ -7,7 +7,7 @@ MapControl.MBTiles XAML Map Control MBTiles Library for WinUI XAML Map Control - 7.2.1 + 7.3.0 Clemens Fischer Copyright © 2022 Clemens Fischer true diff --git a/MapControl/Shared/ImageLoader.cs b/MapControl/Shared/ImageLoader.cs index b7137d2a..779f524f 100644 --- a/MapControl/Shared/ImageLoader.cs +++ b/MapControl/Shared/ImageLoader.cs @@ -29,7 +29,7 @@ namespace MapControl public static HttpClient HttpClient { get; set; } = new HttpClient { Timeout = TimeSpan.FromSeconds(30) }; - public static async Task LoadImageAsync(Uri uri) + public static async Task LoadImageAsync(Uri uri, IProgress progress = null) { ImageSource image = null; @@ -41,7 +41,7 @@ namespace MapControl } else if (uri.Scheme == "http" || uri.Scheme == "https") { - var response = await GetHttpResponseAsync(uri); + var response = await GetHttpResponseAsync(uri, progress); if (response != null && response.Buffer != null) { @@ -73,10 +73,12 @@ namespace MapControl } } - internal static async Task GetHttpResponseAsync(Uri uri) + internal static async Task GetHttpResponseAsync(Uri uri, IProgress progress = null) { HttpResponse response = null; + progress?.Report(0d); + try { using (var responseMessage = await HttpClient.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false)) @@ -85,10 +87,12 @@ namespace MapControl { byte[] buffer = null; + // check for possibly unavailable Bing Maps tile + // if (!responseMessage.Headers.TryGetValues("X-VE-Tile-Info", out IEnumerable tileInfo) || !tileInfo.Contains("no-tile")) { - buffer = await responseMessage.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + buffer = await ReadAsByteArrayAsync(responseMessage.Content, progress).ConfigureAwait(false); } response = new HttpResponse(buffer, responseMessage.Headers.CacheControl?.MaxAge); @@ -104,7 +108,39 @@ namespace MapControl Debug.WriteLine($"ImageLoader: {uri}: {ex.Message}"); } + progress?.Report(1d); + return response; } + + private static async Task ReadAsByteArrayAsync(HttpContent content, IProgress progress) + { + if (progress == null || !content.Headers.ContentLength.HasValue) + { + return await content.ReadAsByteArrayAsync().ConfigureAwait(false); + } + + var length = (int)content.Headers.ContentLength.Value; + var buffer = new byte[length]; + + using (var stream = await content.ReadAsStreamAsync().ConfigureAwait(false)) + { + int offset = 0; + int read; + + while (offset < length && + (read = await stream.ReadAsync(buffer, offset, length - offset).ConfigureAwait(false)) > 0) + { + offset += read; + + if (offset < length) // 1.0 reported by caller + { + progress.Report((double)offset / length); + } + } + } + + return buffer; + } } } \ No newline at end of file diff --git a/MapControl/Shared/MapImageLayer.cs b/MapControl/Shared/MapImageLayer.cs index 52b3fc32..fa7f2176 100644 --- a/MapControl/Shared/MapImageLayer.cs +++ b/MapControl/Shared/MapImageLayer.cs @@ -54,11 +54,17 @@ namespace MapControl public static readonly DependencyProperty MapForegroundProperty = DependencyProperty.Register( nameof(MapForeground), typeof(Brush), typeof(MapImageLayer), new PropertyMetadata(null)); + public static readonly DependencyProperty LoadingProgressProperty = DependencyProperty.Register( + nameof(LoadingProgress), typeof(double), typeof(MapImageLayer), new PropertyMetadata(1d)); + + private readonly Progress imageProgress; private readonly DispatcherTimer updateTimer; private bool updateInProgress; public MapImageLayer() { + imageProgress = new Progress(p => LoadingProgress = p); + updateTimer = this.CreateTimer(UpdateInterval); updateTimer.Tick += async (s, e) => await UpdateImageAsync(); } @@ -119,13 +125,20 @@ namespace MapControl set { SetValue(MapForegroundProperty, value); } } + /// + /// Gets the progress of the ImageLoader as a double value between 0 and 1. + /// + public double LoadingProgress + { + get { return (double)GetValue(LoadingProgressProperty); } + private set { SetValue(LoadingProgressProperty, value); } + } + /// /// The current BoundingBox /// public BoundingBox BoundingBox { get; private set; } - protected abstract Task GetImageAsync(); - protected override void SetParentMap(MapBase map) { if (map == null) @@ -165,38 +178,43 @@ namespace MapControl protected async Task UpdateImageAsync() { - updateTimer.Stop(); - - if (updateInProgress) + if (updateInProgress) // update image on next tick { - updateTimer.Run(); // update image on next timer tick + updateTimer.Run(); // start timer if not running } - else if (ParentMap != null && ParentMap.RenderSize.Width > 0 && ParentMap.RenderSize.Height > 0) + else { - updateInProgress = true; + updateTimer.Stop(); - UpdateBoundingBox(); - - ImageSource image = null; - - if (BoundingBox != null) + if (ParentMap != null && ParentMap.RenderSize.Width > 0 && ParentMap.RenderSize.Height > 0) { - try + updateInProgress = true; + + UpdateBoundingBox(); + + ImageSource image = null; + + if (BoundingBox != null) { - image = await GetImageAsync(); - } - catch (Exception ex) - { - Debug.WriteLine($"MapImageLayer: {ex.Message}"); + try + { + image = await GetImageAsync(imageProgress); + } + catch (Exception ex) + { + Debug.WriteLine($"MapImageLayer: {ex.Message}"); + } } + + SwapImages(image); + + updateInProgress = false; } - - SwapImages(image); - - updateInProgress = false; } } + protected abstract Task GetImageAsync(IProgress progress); + private void UpdateBoundingBox() { var width = ParentMap.RenderSize.Width * RelativeImageSize; diff --git a/MapControl/Shared/MapTileLayerBase.cs b/MapControl/Shared/MapTileLayerBase.cs index 066f7bbc..d295fd14 100644 --- a/MapControl/Shared/MapTileLayerBase.cs +++ b/MapControl/Shared/MapTileLayerBase.cs @@ -25,6 +25,8 @@ namespace MapControl { public interface ITileImageLoader { + IProgress Progress { get; set; } + TileSource TileSource { get; } Task LoadTiles(IEnumerable tiles, TileSource tileSource, string cacheName); @@ -58,13 +60,19 @@ namespace MapControl public static readonly DependencyProperty MapForegroundProperty = DependencyProperty.Register( nameof(MapForeground), typeof(Brush), typeof(MapTileLayerBase), new PropertyMetadata(null)); + public static readonly DependencyProperty LoadingProgressProperty = DependencyProperty.Register( + nameof(LoadingProgress), typeof(double), typeof(MapTileLayerBase), new PropertyMetadata(1d, + (o, e) => { System.Diagnostics.Debug.WriteLine("LoadingProgress = {0:P0}", e.NewValue); })); + private readonly DispatcherTimer updateTimer; private MapBase parentMap; protected MapTileLayerBase(ITileImageLoader tileImageLoader) { RenderTransform = new MatrixTransform(); + TileImageLoader = tileImageLoader; + TileImageLoader.Progress = new Progress(p => LoadingProgress = p); updateTimer = this.CreateTimer(UpdateInterval); updateTimer.Tick += async (s, e) => await Update(); @@ -149,6 +157,15 @@ namespace MapControl set { SetValue(MapForegroundProperty, value); } } + /// + /// Gets the progress of the TileImageLoader as a double value between 0 and 1. + /// + public double LoadingProgress + { + get { return (double)GetValue(LoadingProgressProperty); } + private set { SetValue(LoadingProgressProperty, value); } + } + public MapBase ParentMap { get { return parentMap; } diff --git a/MapControl/Shared/TileImageLoader.cs b/MapControl/Shared/TileImageLoader.cs index 684d951d..60a33f02 100644 --- a/MapControl/Shared/TileImageLoader.cs +++ b/MapControl/Shared/TileImageLoader.cs @@ -9,6 +9,7 @@ using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; +using System.Threading; using System.Threading.Tasks; namespace MapControl @@ -18,6 +19,35 @@ namespace MapControl /// public partial class TileImageLoader : ITileImageLoader { + private class TileQueue : ConcurrentStack + { + public TileQueue(IEnumerable tiles) + : base(tiles.Where(tile => tile.Pending).Reverse()) + { + } + + public bool IsCanceled { get; private set; } + + public bool TryDequeue(out Tile tile) + { + tile = null; + + if (IsCanceled || !TryPop(out tile)) + { + return false; + } + + tile.Pending = false; + return true; + } + + public void Cancel() + { + IsCanceled = true; + Clear(); + } + } + /// /// Maximum number of parallel tile loading tasks. The default value is 4. /// @@ -35,12 +65,19 @@ namespace MapControl /// public static TimeSpan MaxCacheExpiration { get; set; } = TimeSpan.FromDays(10); + /// + /// Reports tile loading process as double value between 0 and 1. + /// + public IProgress Progress { get; set; } + /// /// The current TileSource, passed to the most recent LoadTiles call. /// public TileSource TileSource { get; private set; } - private ConcurrentStack pendingTiles; + private TileQueue pendingTiles; + private int progressTotal; + private int progressLoaded; /// /// Loads all pending tiles from the tiles collection. @@ -49,39 +86,47 @@ namespace MapControl /// public Task LoadTiles(IEnumerable tiles, TileSource tileSource, string cacheName) { - pendingTiles?.Clear(); // stop processing the current queue + pendingTiles?.Cancel(); TileSource = tileSource; if (tileSource != null) { - pendingTiles = new ConcurrentStack(tiles.Where(tile => tile.Pending).Reverse()); + pendingTiles = new TileQueue(tiles); var numTasks = Math.Min(pendingTiles.Count, MaxLoadTasks); if (numTasks > 0) { + if (Progress != null) + { + progressTotal = pendingTiles.Count; + progressLoaded = 0; + Progress.Report(0d); + } + if (Cache == null || tileSource.UriFormat == null || !tileSource.UriFormat.StartsWith("http")) { cacheName = null; // no tile caching } - var tasks = Enumerable.Range(0, numTasks) - .Select(_ => Task.Run(() => LoadPendingTiles(pendingTiles, tileSource, cacheName))); - - return Task.WhenAll(tasks); + return Task.WhenAll(Enumerable.Range(0, numTasks).Select( + _ => Task.Run(() => LoadPendingTiles(pendingTiles, tileSource, cacheName)))); } } + if (Progress != null && progressLoaded < progressTotal) + { + Progress.Report(1d); + } + return Task.CompletedTask; } - private static async Task LoadPendingTiles(ConcurrentStack pendingTiles, TileSource tileSource, string cacheName) + private async Task LoadPendingTiles(TileQueue tileQueue, TileSource tileSource, string cacheName) { - while (pendingTiles.TryPop(out var tile)) + while (tileQueue.TryDequeue(out var tile)) { - tile.Pending = false; - try { await LoadTile(tile, tileSource, cacheName).ConfigureAwait(false); @@ -90,6 +135,13 @@ namespace MapControl { Debug.WriteLine($"TileImageLoader: {tile.ZoomLevel}/{tile.XIndex}/{tile.Y}: {ex.Message}"); } + + if (Progress != null && !tileQueue.IsCanceled) + { + Interlocked.Increment(ref progressLoaded); + + Progress.Report((double)progressLoaded / progressTotal); + } } } diff --git a/MapControl/Shared/WmsImageLayer.cs b/MapControl/Shared/WmsImageLayer.cs index 5b486f75..111b150a 100644 --- a/MapControl/Shared/WmsImageLayer.cs +++ b/MapControl/Shared/WmsImageLayer.cs @@ -34,7 +34,14 @@ namespace MapControl public static readonly DependencyProperty LayersProperty = DependencyProperty.Register( nameof(Layers), typeof(string), typeof(WmsImageLayer), - new PropertyMetadata(null, async (o, e) => await ((WmsImageLayer)o).UpdateImageAsync())); + new PropertyMetadata(null, + async (o, e) => + { + if (e.OldValue != null) // ignore initial property change from GetImageAsync + { + await ((WmsImageLayer)o).UpdateImageAsync(); + } + })); public static readonly DependencyProperty StylesProperty = DependencyProperty.Register( nameof(Styles), typeof(string), typeof(WmsImageLayer), @@ -187,7 +194,7 @@ namespace MapControl /// /// Loads an ImageSource from the URL returned by GetMapRequestUri(). /// - protected override async Task GetImageAsync() + protected override async Task GetImageAsync(IProgress progress) { ImageSource image = null; @@ -203,7 +210,7 @@ namespace MapControl if (!string.IsNullOrEmpty(uri)) { - image = await ImageLoader.LoadImageAsync(new Uri(uri)); + image = await ImageLoader.LoadImageAsync(new Uri(uri), progress); } } diff --git a/MapControl/UWP/Properties/AssemblyInfo.cs b/MapControl/UWP/Properties/AssemblyInfo.cs index 456bf1b5..00f234b2 100644 --- a/MapControl/UWP/Properties/AssemblyInfo.cs +++ b/MapControl/UWP/Properties/AssemblyInfo.cs @@ -6,8 +6,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © 2022 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("7.2.1")] -[assembly: AssemblyFileVersion("7.2.1")] +[assembly: AssemblyVersion("7.3.0")] +[assembly: AssemblyFileVersion("7.3.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MapControl/WPF/MapControl.WPF.csproj b/MapControl/WPF/MapControl.WPF.csproj index e98bfdeb..7ddf2e3d 100644 --- a/MapControl/WPF/MapControl.WPF.csproj +++ b/MapControl/WPF/MapControl.WPF.csproj @@ -5,7 +5,7 @@ MapControl XAML Map Control Library for WPF XAML Map Control - 7.2.1 + 7.3.0 Clemens Fischer Copyright © 2022 Clemens Fischer true diff --git a/MapControl/WPF/MapItemsImageLayer.WPF.cs b/MapControl/WPF/MapItemsImageLayer.WPF.cs index 90ec74a1..d695a3bc 100644 --- a/MapControl/WPF/MapItemsImageLayer.WPF.cs +++ b/MapControl/WPF/MapItemsImageLayer.WPF.cs @@ -2,6 +2,7 @@ // © 2022 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -28,7 +29,7 @@ namespace MapControl set { SetValue(ItemsSourceProperty, value); } } - protected override async Task GetImageAsync() + protected override async Task GetImageAsync(IProgress progress) { ImageSource image = null; var projection = ParentMap?.MapProjection; diff --git a/MapControl/WinUI/MapControl.WinUI.csproj b/MapControl/WinUI/MapControl.WinUI.csproj index 05a1162c..5cea3ffe 100644 --- a/MapControl/WinUI/MapControl.WinUI.csproj +++ b/MapControl/WinUI/MapControl.WinUI.csproj @@ -7,7 +7,7 @@ MapControl XAML Map Control Library for WinUI XAML Map Control - 7.2.1 + 7.3.0 Clemens Fischer Copyright © 2022 Clemens Fischer true diff --git a/MapProjections/UWP/Properties/AssemblyInfo.cs b/MapProjections/UWP/Properties/AssemblyInfo.cs index 18d430e8..da4b4731 100644 --- a/MapProjections/UWP/Properties/AssemblyInfo.cs +++ b/MapProjections/UWP/Properties/AssemblyInfo.cs @@ -6,8 +6,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © 2022 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("7.2.1")] -[assembly: AssemblyFileVersion("7.2.1")] +[assembly: AssemblyVersion("7.3.0")] +[assembly: AssemblyFileVersion("7.3.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MapProjections/WPF/MapProjections.WPF.csproj b/MapProjections/WPF/MapProjections.WPF.csproj index b26dc095..072b55ca 100644 --- a/MapProjections/WPF/MapProjections.WPF.csproj +++ b/MapProjections/WPF/MapProjections.WPF.csproj @@ -5,7 +5,7 @@ MapControl.Projections XAML Map Control Projections Library for WPF XAML Map Control - 7.2.1 + 7.3.0 Clemens Fischer Copyright © 2022 Clemens Fischer true diff --git a/MapProjections/WinUI/MapProjections.WinUI.csproj b/MapProjections/WinUI/MapProjections.WinUI.csproj index 38f1b7ee..f33edb50 100644 --- a/MapProjections/WinUI/MapProjections.WinUI.csproj +++ b/MapProjections/WinUI/MapProjections.WinUI.csproj @@ -7,7 +7,7 @@ MapControl.Projections XAML Map Control Projections Library for WinUI XAML Map Control - 7.2.1 + 7.3.0 Clemens Fischer Copyright © 2022 Clemens Fischer true diff --git a/MapUiTools/UWP/Properties/AssemblyInfo.cs b/MapUiTools/UWP/Properties/AssemblyInfo.cs index 7e736c85..9f2abc6e 100644 --- a/MapUiTools/UWP/Properties/AssemblyInfo.cs +++ b/MapUiTools/UWP/Properties/AssemblyInfo.cs @@ -6,8 +6,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © 2022 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("7.2.1")] -[assembly: AssemblyFileVersion("7.2.1")] +[assembly: AssemblyVersion("7.3.0")] +[assembly: AssemblyFileVersion("7.3.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MapUiTools/WPF/MapUiTools.WPF.csproj b/MapUiTools/WPF/MapUiTools.WPF.csproj index ba6619ed..65bfd448 100644 --- a/MapUiTools/WPF/MapUiTools.WPF.csproj +++ b/MapUiTools/WPF/MapUiTools.WPF.csproj @@ -5,7 +5,7 @@ MapControl.UiTools XAML Map Control UI Tools Library for WPF XAML Map Control - 7.2.1 + 7.3.0 Clemens Fischer Copyright © 2022 Clemens Fischer true diff --git a/MapUiTools/WinUI/MapUiTools.WinUI.csproj b/MapUiTools/WinUI/MapUiTools.WinUI.csproj index 3d4343ea..74511c06 100644 --- a/MapUiTools/WinUI/MapUiTools.WinUI.csproj +++ b/MapUiTools/WinUI/MapUiTools.WinUI.csproj @@ -7,7 +7,7 @@ MapControl.UiTools XAML Map Control UI Tools Library for WinUI XAML Map Control - 7.2.1 + 7.3.0 Clemens Fischer Copyright © 2022 Clemens Fischer true diff --git a/SQLiteCache/UWP/Properties/AssemblyInfo.cs b/SQLiteCache/UWP/Properties/AssemblyInfo.cs index 32186625..bf869fdd 100644 --- a/SQLiteCache/UWP/Properties/AssemblyInfo.cs +++ b/SQLiteCache/UWP/Properties/AssemblyInfo.cs @@ -6,8 +6,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © 2022 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("7.2.1")] -[assembly: AssemblyFileVersion("7.2.1")] +[assembly: AssemblyVersion("7.3.0")] +[assembly: AssemblyFileVersion("7.3.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/SQLiteCache/WPF/SQLiteCache.WPF.csproj b/SQLiteCache/WPF/SQLiteCache.WPF.csproj index 736eae92..8d7f7e0d 100644 --- a/SQLiteCache/WPF/SQLiteCache.WPF.csproj +++ b/SQLiteCache/WPF/SQLiteCache.WPF.csproj @@ -5,7 +5,7 @@ MapControl.Caching XAML Map Control SQLiteCache Library for WPF XAML Map Control - 7.2.1 + 7.3.0 Clemens Fischer Copyright © 2022 Clemens Fischer true diff --git a/SQLiteCache/WinUI/SQLiteCache.WinUI.csproj b/SQLiteCache/WinUI/SQLiteCache.WinUI.csproj index f8e6a014..bc6735a9 100644 --- a/SQLiteCache/WinUI/SQLiteCache.WinUI.csproj +++ b/SQLiteCache/WinUI/SQLiteCache.WinUI.csproj @@ -7,7 +7,7 @@ MapControl.Caching XAML Map Control SQLiteCache Library for WinUI XAML Map Control - 7.2.1 + 7.3.0 Clemens Fischer Copyright © 2022 Clemens Fischer true diff --git a/SampleApps/ProjectionDemo/ProjectionDemo.csproj b/SampleApps/ProjectionDemo/ProjectionDemo.csproj index e7c8dc17..3e71b436 100644 --- a/SampleApps/ProjectionDemo/ProjectionDemo.csproj +++ b/SampleApps/ProjectionDemo/ProjectionDemo.csproj @@ -6,7 +6,7 @@ ProjectionDemo XAML Map Control Projection Demo Application XAML Map Control - 7.2.1 + 7.3.0 Clemens Fischer Copyright © 2022 Clemens Fischer diff --git a/SampleApps/Shared/ValueConverters.cs b/SampleApps/Shared/ValueConverters.cs index dced2c50..c415cfa0 100644 --- a/SampleApps/Shared/ValueConverters.cs +++ b/SampleApps/Shared/ValueConverters.cs @@ -13,11 +13,18 @@ using System.Windows.Data; namespace SampleApplication { - public class HeadingToVisibilityConverter : IValueConverter + public class DoubleToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { - return (double)value != 0d ? Visibility.Visible : Visibility.Collapsed; + if (!(parameter is double p)) + { + p = double.Parse(parameter.ToString()); + } + + //System.Diagnostics.Debug.WriteLine((double)value); + + return (double)value != p ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, string language) diff --git a/SampleApps/UniversalApp/MainPage.xaml b/SampleApps/UniversalApp/MainPage.xaml index e48beeb3..63fe6ba1 100644 --- a/SampleApps/UniversalApp/MainPage.xaml +++ b/SampleApps/UniversalApp/MainPage.xaml @@ -80,6 +80,8 @@ + + @@ -214,14 +216,8 @@ Maximum="{Binding MaxZoomLevel, ElementName=map}" Value="{Binding TargetZoomLevel, ElementName=map, Mode=TwoWay}"/> - diff --git a/SampleApps/UniversalApp/Properties/AssemblyInfo.cs b/SampleApps/UniversalApp/Properties/AssemblyInfo.cs index 1835718f..ef270005 100644 --- a/SampleApps/UniversalApp/Properties/AssemblyInfo.cs +++ b/SampleApps/UniversalApp/Properties/AssemblyInfo.cs @@ -6,8 +6,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © 2022 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("7.2.1")] -[assembly: AssemblyFileVersion("7.2.1")] +[assembly: AssemblyVersion("7.3.0")] +[assembly: AssemblyFileVersion("7.3.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/SampleApps/WinUiApp/MainWindow.xaml b/SampleApps/WinUiApp/MainWindow.xaml index 4e6e0fe8..4a3fb09a 100644 --- a/SampleApps/WinUiApp/MainWindow.xaml +++ b/SampleApps/WinUiApp/MainWindow.xaml @@ -81,6 +81,7 @@ + @@ -112,10 +113,15 @@ - + + + + - + @@ -214,14 +220,8 @@ Maximum="{Binding MaxZoomLevel, ElementName=map}" Value="{Binding TargetZoomLevel, ElementName=map, Mode=TwoWay}"/> - diff --git a/SampleApps/WinUiApp/WinUiApp.csproj b/SampleApps/WinUiApp/WinUiApp.csproj index f5a80199..77cc8e31 100644 --- a/SampleApps/WinUiApp/WinUiApp.csproj +++ b/SampleApps/WinUiApp/WinUiApp.csproj @@ -11,7 +11,7 @@ SampleApplication XAML Map Control WinUI Sample Application XAML Map Control - 7.2.1 + 7.3.0 Clemens Fischer Copyright © 2022 Clemens Fischer none diff --git a/SampleApps/WpfApplication/MainWindow.xaml b/SampleApps/WpfApplication/MainWindow.xaml index e9cebd85..18de204c 100644 --- a/SampleApps/WpfApplication/MainWindow.xaml +++ b/SampleApps/WpfApplication/MainWindow.xaml @@ -138,10 +138,26 @@ - + + + + + + + - + - - - - - - - + + + diff --git a/SampleApps/WpfApplication/WpfApplication.csproj b/SampleApps/WpfApplication/WpfApplication.csproj index ddc9918a..d6de514c 100644 --- a/SampleApps/WpfApplication/WpfApplication.csproj +++ b/SampleApps/WpfApplication/WpfApplication.csproj @@ -6,7 +6,7 @@ SampleApplication XAML Map Control WPF Sample Application XAML Map Control - 7.2.1 + 7.3.0 Clemens Fischer Copyright © 2022 Clemens Fischer