do not show undefined entry in shipcall type combobox

This commit is contained in:
Daniel Schick 2024-04-08 12:38:37 +02:00
parent a905f0921d
commit 553b9131d4

View File

@ -5,6 +5,7 @@
using BreCalClient.misc.Api; using BreCalClient.misc.Api;
using BreCalClient.misc.Model; using BreCalClient.misc.Model;
using System; using System;
using System.Collections.Generic;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using static BreCalClient.Extensions; using static BreCalClient.Extensions;
@ -49,7 +50,15 @@ namespace BreCalClient
this.comboBoxAgency.ItemsSource = BreCalLists.Participants_Agent; this.comboBoxAgency.ItemsSource = BreCalLists.Participants_Agent;
this.comboBoxShip.ItemsSource = BreCalLists.AllShips; this.comboBoxShip.ItemsSource = BreCalLists.AllShips;
this.comboBoxCategories.ItemsSource = Enum.GetValues(typeof(ShipcallType)); Array types = Enum.GetValues(typeof(ShipcallType));
List<ShipcallType> shipcallTypes = new List<ShipcallType>();
bool first = true;
foreach(ShipcallType shipcallType in types)
{
if (!first) shipcallTypes.Add(shipcallType);
else first = false;
}
this.comboBoxCategories.ItemsSource = shipcallTypes;
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths; this.comboBoxArrivalBerth.ItemsSource = BreCalLists.Berths;
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths; this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths;