From d116c06b9e08954720ee9692251fc96c8046ecc3 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Tue, 26 Dec 2023 08:41:54 +0100 Subject: [PATCH] Enabled combobox ship search by adding helper container class ShipModel --- src/BreCalClient/BreCalLists.cs | 25 ++++++++++---------- src/BreCalClient/EditShipcallControl.xaml | 17 +------------ src/BreCalClient/EditShipcallControl.xaml.cs | 10 ++++---- src/BreCalClient/MainWindow.xaml.cs | 4 ++-- src/BreCalClient/ShipModel.cs | 24 +++++++++++++++++++ 5 files changed, 45 insertions(+), 35 deletions(-) create mode 100644 src/BreCalClient/ShipModel.cs diff --git a/src/BreCalClient/BreCalLists.cs b/src/BreCalClient/BreCalLists.cs index 39746cd..3857e90 100644 --- a/src/BreCalClient/BreCalLists.cs +++ b/src/BreCalClient/BreCalLists.cs @@ -23,10 +23,10 @@ namespace BreCalClient private static readonly List _berths = new(); private static List _allBerths = new(); private static List _participants = new(); - private static readonly List _ships = new(); - private static List _allShips = new(); + private static readonly List _ships = new(); + private static readonly List _allShips = new(); - private readonly static ConcurrentDictionary _shipLookupDict = new(); + private readonly static ConcurrentDictionary _shipLookupDict = new(); private readonly static ConcurrentDictionary _berthLookupDict = new(); private readonly static Dictionary _participantLookupDict = new(); @@ -34,7 +34,7 @@ namespace BreCalClient #region Properties - public static ConcurrentDictionary ShipLookupDict { get { return _shipLookupDict; } } + public static ConcurrentDictionary ShipLookupDict { get { return _shipLookupDict; } } public static ConcurrentDictionary BerthLookupDict { get { return _berthLookupDict; } } @@ -76,19 +76,19 @@ namespace BreCalClient public static List Berths { get { return _berths; } } /// - /// All active berths + /// All berths including deleted berths /// public static List AllBerths { get { return _allBerths; } } /// /// All active ships /// - public static List Ships { get { return _ships; } } + public static List Ships { get { return _ships; } } /// - /// All active berths + /// All ships including deleted ships /// - public static List AllShips { get { return _allShips; } } + public static List AllShips { get { return _allShips; } } #endregion @@ -130,11 +130,12 @@ namespace BreCalClient { foreach (var ship in ships) { - _shipLookupDict[ship.Id] = ship; + ShipModel sm = new ShipModel(ship); + _shipLookupDict[ship.Id] = sm; if (!ship.Deleted) - _ships.Add(ship); - } - _allShips = ships; + _ships.Add(sm); + _allShips.Add(sm); + } } #endregion diff --git a/src/BreCalClient/EditShipcallControl.xaml b/src/BreCalClient/EditShipcallControl.xaml index 7be23c1..70b4145 100644 --- a/src/BreCalClient/EditShipcallControl.xaml +++ b/src/BreCalClient/EditShipcallControl.xaml @@ -30,22 +30,7 @@