From 8a44a664dd85a068e8a8a62f1c1bd70e01c9d76b Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Thu, 19 Feb 2026 11:30:40 +0100 Subject: [PATCH] bugfix for portarea blocking the app during startup --- .../DetailViewControls/PortNotificationDetailControl.xaml.cs | 2 +- ENI2/SheetDisplayControls/PortControl.xaml.cs | 2 +- bsmd.database/PortArea.cs | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs index 8e681dc9..b8da8be2 100644 --- a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs @@ -123,7 +123,7 @@ namespace ENI2.DetailViewControls _infoMessage.Elements.Add(info); } - portAreas = PortArea.getPortAreasForLocode(this.Core.PoC); + portAreas = await PortArea.getPortAreasForLocode(this.Core.PoC); this.comboBoxPortArea.ItemsSource = portAreas; this.comboBoxShippingArea.ItemsSource = shippingAreas; diff --git a/ENI2/SheetDisplayControls/PortControl.xaml.cs b/ENI2/SheetDisplayControls/PortControl.xaml.cs index 31deb744..47497c90 100644 --- a/ENI2/SheetDisplayControls/PortControl.xaml.cs +++ b/ENI2/SheetDisplayControls/PortControl.xaml.cs @@ -108,7 +108,7 @@ namespace ENI2.SheetDisplayControls this.dataGridCallPurposes.CreateRequested += DataGridCallPurposes_CreateRequested; this.dataGridCallPurposes.DeleteRequested += DataGridCallPurposes_DeleteRequested; - portAreas = PortArea.getPortAreasForLocode(this.Core.PoC); + portAreas = await PortArea.getPortAreasForLocode(this.Core.PoC); this.comboBoxPortArea.ItemsSource = portAreas; this.comboBoxPortArea.DataContext = this._info; this.textRequestedPostionInPortOfCall.DataContext = this._info; diff --git a/bsmd.database/PortArea.cs b/bsmd.database/PortArea.cs index be44b03d..3fad1442 100644 --- a/bsmd.database/PortArea.cs +++ b/bsmd.database/PortArea.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; +using System.Threading.Tasks; namespace bsmd.database { @@ -67,11 +68,11 @@ namespace bsmd.database return result; } - public static Dictionary getPortAreasForLocode(string locode) + public static async Task> getPortAreasForLocode(string locode) { Dictionary result = new Dictionary(); - List portAreas = DBManagerAsync.LoadPortAreasAsync().Result; + List portAreas = await DBManagerAsync.LoadPortAreasAsync(); foreach (PortArea portArea in portAreas) {