Fixed small issues when creating a new ship

This commit is contained in:
Daniel Schick 2024-04-10 10:21:34 +02:00
parent 89d9243181
commit 7fec9905fd
2 changed files with 12 additions and 8 deletions

View File

@ -28,7 +28,7 @@ namespace BreCalClient
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
this.Ship.Name = this.textBoxName.Text.Trim();
this.Ship.Name = this.textBoxName.Text.ToUpper().Trim();
if (this.comboBoxParticipants.SelectedItem != null)
{
@ -40,7 +40,7 @@ namespace BreCalClient
this.Ship.IsTug = false;
}
this.Ship.Imo = this.integerUpDownIMO.Value;
this.Ship.Callsign = this.textBoxCallsign.Text.Trim();
this.Ship.Callsign = this.textBoxCallsign.Text.ToUpper().Trim();
this.Ship.Length = (float?) this.doubleUpDownLength.Value;
this.Ship.Width = (float?) this.doubleUpDownWidth.Value;
this.DialogResult = true;

View File

@ -83,7 +83,7 @@ namespace BreCalClient
}
}
private void DataGridShips_CreateRequested()
private async void DataGridShips_CreateRequested()
{
ShipModel shipModel = new ShipModel(new Ship());
EditShipDialog esd = new()
@ -96,11 +96,15 @@ namespace BreCalClient
{
try
{
this.ShipApi?.ShipsCreateAsync(shipModel.Ship);
this.dataGridShips.ItemsSource = null;
BreCalLists.AllShips.Add(shipModel);
BreCalLists.Ships.Add(shipModel);
this.dataGridShips.ItemsSource = BreCalLists.AllShips;
if (this.ShipApi != null)
{
Id id = await this.ShipApi.ShipsCreateAsync(shipModel.Ship);
shipModel.Ship.Id = id.VarId;
this.dataGridShips.ItemsSource = null;
BreCalLists.AllShips.Add(shipModel);
BreCalLists.Ships.Add(shipModel);
this.dataGridShips.ItemsSource = BreCalLists.AllShips;
}
}
catch (Exception ex)
{