diff --git a/src/BreCalClient/EditShipcallControl.xaml b/src/BreCalClient/EditShipcallControl.xaml
index 8f20e1b..ae2df90 100644
--- a/src/BreCalClient/EditShipcallControl.xaml
+++ b/src/BreCalClient/EditShipcallControl.xaml
@@ -65,24 +65,15 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
diff --git a/src/BreCalClient/EditShipcallControl.xaml.cs b/src/BreCalClient/EditShipcallControl.xaml.cs
index 9c157e7..2456bd9 100644
--- a/src/BreCalClient/EditShipcallControl.xaml.cs
+++ b/src/BreCalClient/EditShipcallControl.xaml.cs
@@ -66,8 +66,7 @@ namespace BreCalClient
}
private void comboBoxShip_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- this.buttonOK.IsEnabled = this.comboBoxShip.SelectedItem != null;
+ {
if (this.comboBoxShip.SelectedItem != null)
{
Ship? ship = this.comboBoxShip.SelectedItem as Ship;
@@ -83,11 +82,13 @@ namespace BreCalClient
this.doubleUpDownLength.Value = null;
this.doubleUpDownWidth.Value = null;
}
+ this.CheckForCompletion();
}
private void comboBoxAgency_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.EnableControls();
+ this.CheckForCompletion();
}
private void comboBoxCategories_SelectionChanged(object? sender, SelectionChangedEventArgs? e)
@@ -121,6 +122,7 @@ namespace BreCalClient
break;
}
}
+ this.CheckForCompletion();
}
#endregion
@@ -132,22 +134,24 @@ namespace BreCalClient
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
+ void CheckForCompletion()
+ {
+ bool isEnabled = true;
+
+ isEnabled &= this.comboBoxShip.SelectedItem != null;
+ isEnabled &= this.comboBoxCategories.SelectedItem != null;
+ isEnabled &= ((this.comboBoxArrivalBerth.SelectedItem != null) || (this.comboBoxDepartureBerth.SelectedItem != null));
+ isEnabled &= (this.datePickerETA.Value.HasValue || this.datePickerETD.Value.HasValue);
+ isEnabled &= this.comboBoxAgency.SelectedItem != null;
+
+ this.buttonOK.IsEnabled = isEnabled;
+ }
+
private void CopyToModel()
{
if (this.ShipcallModel.Shipcall != null)
@@ -292,5 +296,24 @@ namespace BreCalClient
#endregion
+ private void datePickerETA_ValueChanged(object sender, RoutedPropertyChangedEventArgs