From e33d67177c59985d2cdb89e9995e7c72e0e63f86 Mon Sep 17 00:00:00 2001 From: "sushi.at" Date: Tue, 26 Dec 2023 12:31:14 +0000 Subject: [PATCH] Small fixed release - Propper fix for aircraft type image caching bug - Map view resize will now re-render tiles - New aircraft dialog disabled right side of view when no type is selected yet --- OpenSky.Client.sln.DotSettings | 1 + OpenSky.Client/Controls/MapView.xaml | 2 +- OpenSky.Client/Controls/MapView.xaml.cs | 20 +++++++++++++++++++ .../Models/AircraftTypeDetailsViewModel.cs | 10 ++++++++-- .../NullItemToVisibilityConverter.cs | 5 +++++ OpenSky.Client/Pages/NewAircraft.xaml | 3 +++ OpenSky.Client/Properties/AssemblyInfo.cs | 4 ++-- changelog.txt | 7 +++++++ 8 files changed, 47 insertions(+), 5 deletions(-) diff --git a/OpenSky.Client.sln.DotSettings b/OpenSky.Client.sln.DotSettings index 87c374c..d2d84a0 100644 --- a/OpenSky.Client.sln.DotSettings +++ b/OpenSky.Client.sln.DotSettings @@ -624,6 +624,7 @@ OpenSky project 2021-${CurrentDate.Year} True True True + True True True True diff --git a/OpenSky.Client/Controls/MapView.xaml b/OpenSky.Client/Controls/MapView.xaml index be750dd..584124f 100644 --- a/OpenSky.Client/Controls/MapView.xaml +++ b/OpenSky.Client/Controls/MapView.xaml @@ -20,7 +20,7 @@ xmlns:ui="http://schemas.modernwpf.com/2019" xmlns:converters="clr-namespace:OpenSky.Client.Converters" xmlns:controls="clr-namespace:OpenSky.Client.Controls" - Loaded="MapViewOnLoaded" Unloaded="MapViewOnUnloaded" + Loaded="MapViewOnLoaded" Unloaded="MapViewOnUnloaded" SizeChanged="MapViewSizeChanged" d:DesignHeight="450" d:DesignWidth="800" MouseWheel="MapViewOnMouseWheel"> diff --git a/OpenSky.Client/Controls/MapView.xaml.cs b/OpenSky.Client/Controls/MapView.xaml.cs index d0999ef..a8dc0c2 100644 --- a/OpenSky.Client/Controls/MapView.xaml.cs +++ b/OpenSky.Client/Controls/MapView.xaml.cs @@ -823,6 +823,26 @@ private void MapViewOnUnloaded(object sender, RoutedEventArgs e) } } + /// ------------------------------------------------------------------------------------------------- + /// + /// Map view size changed. + /// + /// + /// sushi.at, 26/12/2023. + /// + /// + /// Source of the event. + /// + /// + /// Size changed event information. + /// + /// ------------------------------------------------------------------------------------------------- + private void MapViewSizeChanged(object sender, SizeChangedEventArgs e) + { + this.WpfMapView.ZoomLevel += 1; + this.WpfMapView.ZoomLevel -= 1; + } + /// ------------------------------------------------------------------------------------------------- /// /// simBrief waypoint markers collection changed. diff --git a/OpenSky.Client/Controls/Models/AircraftTypeDetailsViewModel.cs b/OpenSky.Client/Controls/Models/AircraftTypeDetailsViewModel.cs index ab40458..00573b5 100644 --- a/OpenSky.Client/Controls/Models/AircraftTypeDetailsViewModel.cs +++ b/OpenSky.Client/Controls/Models/AircraftTypeDetailsViewModel.cs @@ -267,7 +267,10 @@ private void GetAircraftImage() this.AircraftImage = image; lock (ImageCache) { - ImageCache.Add(typeCopy.Id, image); + if (!ImageCache.ContainsKey(typeCopy.Id)) + { + ImageCache.Add(typeCopy.Id, image); + } } } catch (Exception ex) @@ -287,7 +290,10 @@ private void GetAircraftImage() this.AircraftImagePlaceholderText = "No image available"; lock (ImageCache) { - ImageCache.Add(typeCopy.Id, null); + if (!ImageCache.ContainsKey(typeCopy.Id)) + { + ImageCache.Add(typeCopy.Id, null); + } } }); } diff --git a/OpenSky.Client/Converters/NullItemToVisibilityConverter.cs b/OpenSky.Client/Converters/NullItemToVisibilityConverter.cs index a2c3a41..463573f 100644 --- a/OpenSky.Client/Converters/NullItemToVisibilityConverter.cs +++ b/OpenSky.Client/Converters/NullItemToVisibilityConverter.cs @@ -48,6 +48,11 @@ public class NullItemToVisibilityConverter : IValueConverter /// ------------------------------------------------------------------------------------------------- public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { + if (parameter is string and "invert") + { + return value != null ? Visibility.Collapsed : Visibility.Visible; + } + return value == null ? Visibility.Collapsed : Visibility.Visible; } diff --git a/OpenSky.Client/Pages/NewAircraft.xaml b/OpenSky.Client/Pages/NewAircraft.xaml index 2bb008e..e17ab4a 100644 --- a/OpenSky.Client/Pages/NewAircraft.xaml +++ b/OpenSky.Client/Pages/NewAircraft.xaml @@ -268,5 +268,8 @@ + + No aircraft type selected + diff --git a/OpenSky.Client/Properties/AssemblyInfo.cs b/OpenSky.Client/Properties/AssemblyInfo.cs index 10b0f19..617d25b 100644 --- a/OpenSky.Client/Properties/AssemblyInfo.cs +++ b/OpenSky.Client/Properties/AssemblyInfo.cs @@ -21,8 +21,8 @@ [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] -[assembly: AssemblyVersion("0.5.10")] -[assembly: AssemblyFileVersion("0.5.10")] +[assembly: AssemblyVersion("0.5.11")] +[assembly: AssemblyFileVersion("0.5.11")] // This allows us to detect debug mode in XAML #if DEBUG diff --git a/changelog.txt b/changelog.txt index 9d06b5b..131e9a2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,13 @@ OpenSky Client Changelog ====================================================================================== +-------------------------------------------------------------------------------------- +Version 0.5.11 (ALPHA5) +-------------------------------------------------------------------------------------- +- Propper fix for aircraft type image caching bug +- Map view resize will now re-render tiles +- New aircraft dialog disabled right side of view when no type is selected yet + -------------------------------------------------------------------------------------- Version 0.5.10 (ALPHA5) --------------------------------------------------------------------------------------