bugfix for portarea blocking the app during startup

This commit is contained in:
Daniel Schick 2026-02-19 11:30:40 +01:00
parent 90a4915683
commit 8a44a664dd
3 changed files with 5 additions and 4 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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<string, string> getPortAreasForLocode(string locode)
public static async Task<Dictionary<string, string>> getPortAreasForLocode(string locode)
{
Dictionary<string, string> result = new Dictionary<string, string>();
List<PortArea> portAreas = DBManagerAsync.LoadPortAreasAsync().Result;
List<PortArea> portAreas = await DBManagerAsync.LoadPortAreasAsync();
foreach (PortArea portArea in portAreas)
{