diff --git a/src/BreCalClient/EditTimesControl.xaml b/src/BreCalClient/EditTimesControl.xaml index bf5ce84..fdfa2fd 100644 --- a/src/BreCalClient/EditTimesControl.xaml +++ b/src/BreCalClient/EditTimesControl.xaml @@ -44,7 +44,7 @@ - + @@ -76,7 +76,7 @@ - + @@ -153,7 +153,7 @@ - + diff --git a/src/BreCalClient/EditTimesControl.xaml.cs b/src/BreCalClient/EditTimesControl.xaml.cs index b5d46be..710e81f 100644 --- a/src/BreCalClient/EditTimesControl.xaml.cs +++ b/src/BreCalClient/EditTimesControl.xaml.cs @@ -65,16 +65,6 @@ namespace BreCalClient SetLockButton(newValue); } - private void datePickerETABerth_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) - { - CheckOKButton(); - } - - private void datePickerETDBerth_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) - { - CheckOKButton(); - } - #endregion #region private methods @@ -99,15 +89,13 @@ namespace BreCalClient if(this.datePickerETABerth.IsEnabled && (this.Times.EtaBerth == null) && (this.AgencyTimes?.EtaBerth != null) && (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival)) { this.datePickerETABerth.Value = this.AgencyTimes.EtaBerth; - WatermarkTextBox? tb = this.datePickerETABerth.Template.FindName("PART_TextBox", this.datePickerETABerth) as WatermarkTextBox; - if (tb != null) { tb.Focus(); tb.SelectAll(); } + if (this.datePickerETABerth.Template.FindName("PART_TextBox", this.datePickerETABerth) is WatermarkTextBox tb) { tb.Focus(); tb.SelectAll(); } } this.datePickerETDBerth.Value = this.Times.EtdBerth; if(this.datePickerETDBerth.IsEnabled && (this.Times.EtdBerth == null) && (this.AgencyTimes?.EtdBerth != null) && ((ShipcallModel.Shipcall?.Type == ShipcallType.Departure) || (ShipcallModel.Shipcall?.Type == ShipcallType.Shifting))) { this.datePickerETDBerth.Value = this.AgencyTimes.EtdBerth; - WatermarkTextBox? tb = this.datePickerETDBerth.Template.FindName("PART_TextBox", this.datePickerETDBerth) as WatermarkTextBox; - if (tb != null) tb.SelectAll(); + if (this.datePickerETDBerth.Template.FindName("PART_TextBox", this.datePickerETDBerth) is WatermarkTextBox tb) tb.SelectAll(); } this.datePickerLockTime.Value = this.Times.LockTime; @@ -141,20 +129,7 @@ namespace BreCalClient this.labelETA.Content = BreCalClient.Resources.Resources.textETABerth; this.labelETD.Content = BreCalClient.Resources.Resources.textETDBerth; } - } - - switch (ShipcallModel.Shipcall?.Type) - { - case ShipcallType.Arrival: - this.labelETA.FontWeight = FontWeights.Bold; - this.datePickerETABerth.ContextMenu.IsEnabled = false; - break; - case ShipcallType.Departure: - case ShipcallType.Shifting: - this.labelETD.FontWeight = FontWeights.Bold; - this.datePickerETDBerth.ContextMenu.IsEnabled = false; - break; - } + } this.SetLockButton(this.Times.EtaBerthFixed ?? false); } @@ -222,10 +197,7 @@ namespace BreCalClient case Extensions.ParticipantType.PILOT: this.datePickerZoneEntry.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival); break; - } - - CheckOKButton(); - + } } private void SetLockButton(bool newValue) @@ -242,17 +214,7 @@ namespace BreCalClient this.imageFixedOrder.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/lock_open.png", UriKind.RelativeOrAbsolute)); this.buttonFixedOrder.ToolTip = BreCalClient.Resources.Resources.textTooltipSetFixedOrder; } - } - - private void CheckOKButton() - { - Extensions.ParticipantType pType = (Extensions.ParticipantType)this.Times.ParticipantType; - if (pType != Extensions.ParticipantType.PORT_ADMINISTRATION) - this.buttonOK.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival) ? - this.datePickerETABerth.Value.HasValue : this.datePickerETDBerth.Value.HasValue; - else - this.buttonOK.IsEnabled = true; - } + } #endregion diff --git a/src/BreCalClient/EditTimesTerminalControl.xaml b/src/BreCalClient/EditTimesTerminalControl.xaml index e1b96ad..86008cd 100644 --- a/src/BreCalClient/EditTimesTerminalControl.xaml +++ b/src/BreCalClient/EditTimesTerminalControl.xaml @@ -38,7 +38,7 @@ - + @@ -69,7 +69,7 @@ - + diff --git a/src/BreCalClient/EditTimesTerminalControl.xaml.cs b/src/BreCalClient/EditTimesTerminalControl.xaml.cs index a80a1a6..92f8111 100644 --- a/src/BreCalClient/EditTimesTerminalControl.xaml.cs +++ b/src/BreCalClient/EditTimesTerminalControl.xaml.cs @@ -76,16 +76,6 @@ namespace BreCalClient this.comboBoxPierside.SelectedIndex = -1; } - private void datePickerOperationStart_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) - { - this.CheckOKButton(); - } - - private void datePickerOperationEnd_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) - { - this.CheckOKButton(); - } - #endregion #region private methods @@ -122,8 +112,6 @@ namespace BreCalClient switch (ShipcallModel.Shipcall?.Type) { case ShipcallType.Arrival: - this.labelStart.FontWeight = FontWeights.Bold; - this.datePickerOperationStart.ContextMenu.IsEnabled = false; this.labelEnd.Visibility = Visibility.Hidden; this.datePickerOperationEnd.Visibility = Visibility.Hidden; this.datePickerOperationEnd_End.Visibility = Visibility.Hidden; @@ -131,7 +119,6 @@ namespace BreCalClient break; case ShipcallType.Departure: this.rowStart.Height = new(0); - this.labelEnd.FontWeight = FontWeights.Bold; this.labelBerth.Visibility = Visibility.Hidden; this.comboBoxBerth.Visibility= Visibility.Hidden; this.labelPierside.Visibility = Visibility.Hidden; @@ -140,9 +127,7 @@ namespace BreCalClient this.textBoxBerthRemarks.Visibility = Visibility.Hidden; break; case ShipcallType.Shifting: - this.rowStart.Height = new(0); - this.labelEnd.FontWeight = FontWeights.Bold; - this.datePickerOperationEnd.ContextMenu.IsEnabled = false; + this.rowStart.Height = new(0); this.labelBerth.Visibility = Visibility.Hidden; this.comboBoxBerth.Visibility = Visibility.Hidden; this.labelPierside.Visibility = Visibility.Hidden; @@ -166,15 +151,8 @@ namespace BreCalClient this.comboBoxPierside.IsEnabled = ShipcallModel.Shipcall?.Type == ShipcallType.Arrival; this.textBoxBerthRemarks.IsReadOnly = ShipcallModel.Shipcall?.Type != ShipcallType.Arrival; this.textBoxRemarks.IsReadOnly = false; - - this.CheckOKButton(); - } - - private void CheckOKButton() - { - this.buttonOK.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival) ? this.datePickerOperationStart.Value.HasValue : - this.datePickerOperationEnd.Value.HasValue; - } + + } #endregion