bugfix enable controls correctly on dialog load

This commit is contained in:
Daniel Schick 2023-10-13 09:53:04 +02:00 committed by puls200
parent 5ed0a08ca2
commit 2d8a895e9f

View File

@ -90,31 +90,10 @@ namespace BreCalClient
this.EnableControls();
}
#endregion
#region Context menu handlers
private void contextMenuItemClearAgency_Click(object sender, RoutedEventArgs e)
{
this.comboBoxAgency.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.AGENCY);
}
private void contextMenuItemArrivalBerth_Click(object sender, RoutedEventArgs e)
{
this.comboBoxArrivalBerth.SelectedIndex = -1;
this.ShipcallModel.Berth = "";
}
private void contextMenuItemDepartureBerth_Click(object sender, RoutedEventArgs e)
{
this.comboBoxDepartureBerth.SelectedIndex -= 1;
}
private void comboBoxCategories_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void comboBoxCategories_SelectionChanged(object? sender, SelectionChangedEventArgs? e)
{
TypeEnum? type = this.comboBoxCategories.SelectedItem as TypeEnum?;
if(type != null)
if (type != null)
{
switch (type)
{
@ -146,6 +125,27 @@ namespace BreCalClient
#endregion
#region Context menu handlers
private void contextMenuItemClearAgency_Click(object sender, RoutedEventArgs e)
{
this.comboBoxAgency.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.AGENCY);
}
private void contextMenuItemArrivalBerth_Click(object sender, RoutedEventArgs e)
{
this.comboBoxArrivalBerth.SelectedIndex = -1;
this.ShipcallModel.Berth = "";
}
private void contextMenuItemDepartureBerth_Click(object sender, RoutedEventArgs e)
{
this.comboBoxDepartureBerth.SelectedIndex -= 1;
}
#endregion
#region private methods
private void CopyToModel()
@ -184,7 +184,8 @@ namespace BreCalClient
// get port authority from berth
int? berthId = this.ShipcallModel.Shipcall.ArrivalBerthId;
if (berthId == null) berthId = this.ShipcallModel.Shipcall.DepartureBerthId;
berthId ??= this.ShipcallModel.Shipcall.DepartureBerthId;
if (berthId != null)
{
Berth? selectedBerth = BreCalLists.Berths.Find((x) => x.Id == berthId);
@ -266,8 +267,9 @@ namespace BreCalClient
this.datePickerETA.IsEnabled = isAgency || isBsmd;
this.datePickerETD.IsEnabled = isAgency;
this.labelBSMDGranted.Visibility = editRightGrantedForBSMD ? Visibility.Visible : Visibility.Hidden;
this.comboBoxCategories_SelectionChanged(null, null);
}
#endregion