remove required fields for Times and Times Terminal

This commit is contained in:
Daniel Schick 2024-07-22 08:22:09 +02:00
parent 31c54f9d8f
commit 9bf84f8baa
4 changed files with 13 additions and 73 deletions

View File

@ -44,7 +44,7 @@
<ColumnDefinition Width=".5*" /> <ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="0" Grid.Column="0" Margin="4,2,0,2" x:Name="datePickerETABerth" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETABerth_ValueChanged"> <local:DateTimePickerExt IsEnabled="False" Grid.Row="0" Grid.Column="0" Margin="4,2,0,2" x:Name="datePickerETABerth" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu> <xctk:DateTimePicker.ContextMenu>
<ContextMenu> <ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearETA" Click="contextMenuItemClearETA_Click" > <MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearETA" Click="contextMenuItemClearETA_Click" >
@ -76,7 +76,7 @@
<ColumnDefinition Width=".5*" /> <ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="0" Grid.Column="0" Margin="2" x:Name="datePickerETDBerth" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETDBerth_ValueChanged"> <local:DateTimePickerExt IsEnabled="False" Grid.Row="0" Grid.Column="0" Margin="2" x:Name="datePickerETDBerth" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu> <xctk:DateTimePicker.ContextMenu>
<ContextMenu> <ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearETD" Click="contextMenuItemClearETD_Click" > <MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearETD" Click="contextMenuItemClearETD_Click" >
@ -153,7 +153,7 @@
<TextBox Grid.Row="7" Grid.Column="1" Margin="2" Name="textBoxRemarks" TextWrapping="Wrap" AcceptsReturn="True" SpellCheck.IsEnabled="True" AcceptsTab="False" IsReadOnly="True" MaxLength="512"/> <TextBox Grid.Row="7" Grid.Column="1" Margin="2" Name="textBoxRemarks" TextWrapping="Wrap" AcceptsReturn="True" SpellCheck.IsEnabled="True" AcceptsTab="False" IsReadOnly="True" MaxLength="512"/>
<StackPanel Grid.Row="8" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right"> <StackPanel Grid.Row="8" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width= "80" Margin="2" Content="{x:Static p:Resources.textOK}" x:Name="buttonOK" Click="buttonOK_Click" IsEnabled="False" /> <Button Width= "80" Margin="2" Content="{x:Static p:Resources.textOK}" x:Name="buttonOK" Click="buttonOK_Click" />
<Button Width="80" Margin="2" Content="{x:Static p:Resources.textCancel}" x:Name="buttonCancel" Click="buttonCancel_Click"/> <Button Width="80" Margin="2" Content="{x:Static p:Resources.textCancel}" x:Name="buttonCancel" Click="buttonCancel_Click"/>
</StackPanel> </StackPanel>

View File

@ -65,16 +65,6 @@ namespace BreCalClient
SetLockButton(newValue); SetLockButton(newValue);
} }
private void datePickerETABerth_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
CheckOKButton();
}
private void datePickerETDBerth_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
CheckOKButton();
}
#endregion #endregion
#region private methods #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)) if(this.datePickerETABerth.IsEnabled && (this.Times.EtaBerth == null) && (this.AgencyTimes?.EtaBerth != null) && (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival))
{ {
this.datePickerETABerth.Value = this.AgencyTimes.EtaBerth; this.datePickerETABerth.Value = this.AgencyTimes.EtaBerth;
WatermarkTextBox? tb = this.datePickerETABerth.Template.FindName("PART_TextBox", this.datePickerETABerth) as WatermarkTextBox; if (this.datePickerETABerth.Template.FindName("PART_TextBox", this.datePickerETABerth) is WatermarkTextBox tb) { tb.Focus(); tb.SelectAll(); }
if (tb != null) { tb.Focus(); tb.SelectAll(); }
} }
this.datePickerETDBerth.Value = this.Times.EtdBerth; 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))) 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; this.datePickerETDBerth.Value = this.AgencyTimes.EtdBerth;
WatermarkTextBox? tb = this.datePickerETDBerth.Template.FindName("PART_TextBox", this.datePickerETDBerth) as WatermarkTextBox; if (this.datePickerETDBerth.Template.FindName("PART_TextBox", this.datePickerETDBerth) is WatermarkTextBox tb) tb.SelectAll();
if (tb != null) tb.SelectAll();
} }
this.datePickerLockTime.Value = this.Times.LockTime; this.datePickerLockTime.Value = this.Times.LockTime;
@ -141,20 +129,7 @@ namespace BreCalClient
this.labelETA.Content = BreCalClient.Resources.Resources.textETABerth; this.labelETA.Content = BreCalClient.Resources.Resources.textETABerth;
this.labelETD.Content = BreCalClient.Resources.Resources.textETDBerth; 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); this.SetLockButton(this.Times.EtaBerthFixed ?? false);
} }
@ -222,10 +197,7 @@ namespace BreCalClient
case Extensions.ParticipantType.PILOT: case Extensions.ParticipantType.PILOT:
this.datePickerZoneEntry.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival); this.datePickerZoneEntry.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
break; break;
} }
CheckOKButton();
} }
private void SetLockButton(bool newValue) 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.imageFixedOrder.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/lock_open.png", UriKind.RelativeOrAbsolute));
this.buttonFixedOrder.ToolTip = BreCalClient.Resources.Resources.textTooltipSetFixedOrder; 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 #endregion

View File

@ -38,7 +38,7 @@
<ColumnDefinition Width=".5*" /> <ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<local:DateTimePickerExt Grid.Row="0" Grid.Column="0" Margin="2" x:Name="datePickerOperationStart" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False" ValueChanged="datePickerOperationStart_ValueChanged"> <local:DateTimePickerExt Grid.Row="0" Grid.Column="0" Margin="2" x:Name="datePickerOperationStart" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False" >
<xctk:DateTimePicker.ContextMenu> <xctk:DateTimePicker.ContextMenu>
<ContextMenu> <ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearOperationStart" Click="contextMenuItemClearOperationStart_Click" > <MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearOperationStart" Click="contextMenuItemClearOperationStart_Click" >
@ -69,7 +69,7 @@
<ColumnDefinition Width=".5*" /> <ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<local:DateTimePickerExt Grid.Row="0" Grid.Column="0" Margin="2" x:Name="datePickerOperationEnd" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False" ValueChanged="datePickerOperationEnd_ValueChanged"> <local:DateTimePickerExt Grid.Row="0" Grid.Column="0" Margin="2" x:Name="datePickerOperationEnd" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False" >
<xctk:DateTimePicker.ContextMenu> <xctk:DateTimePicker.ContextMenu>
<ContextMenu> <ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearOperationEnd" Click="contextMenuItemClearOperationEnd_Click" > <MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearOperationEnd" Click="contextMenuItemClearOperationEnd_Click" >

View File

@ -76,16 +76,6 @@ namespace BreCalClient
this.comboBoxPierside.SelectedIndex = -1; this.comboBoxPierside.SelectedIndex = -1;
} }
private void datePickerOperationStart_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
this.CheckOKButton();
}
private void datePickerOperationEnd_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
this.CheckOKButton();
}
#endregion #endregion
#region private methods #region private methods
@ -122,8 +112,6 @@ namespace BreCalClient
switch (ShipcallModel.Shipcall?.Type) switch (ShipcallModel.Shipcall?.Type)
{ {
case ShipcallType.Arrival: case ShipcallType.Arrival:
this.labelStart.FontWeight = FontWeights.Bold;
this.datePickerOperationStart.ContextMenu.IsEnabled = false;
this.labelEnd.Visibility = Visibility.Hidden; this.labelEnd.Visibility = Visibility.Hidden;
this.datePickerOperationEnd.Visibility = Visibility.Hidden; this.datePickerOperationEnd.Visibility = Visibility.Hidden;
this.datePickerOperationEnd_End.Visibility = Visibility.Hidden; this.datePickerOperationEnd_End.Visibility = Visibility.Hidden;
@ -131,7 +119,6 @@ namespace BreCalClient
break; break;
case ShipcallType.Departure: case ShipcallType.Departure:
this.rowStart.Height = new(0); this.rowStart.Height = new(0);
this.labelEnd.FontWeight = FontWeights.Bold;
this.labelBerth.Visibility = Visibility.Hidden; this.labelBerth.Visibility = Visibility.Hidden;
this.comboBoxBerth.Visibility= Visibility.Hidden; this.comboBoxBerth.Visibility= Visibility.Hidden;
this.labelPierside.Visibility = Visibility.Hidden; this.labelPierside.Visibility = Visibility.Hidden;
@ -140,9 +127,7 @@ namespace BreCalClient
this.textBoxBerthRemarks.Visibility = Visibility.Hidden; this.textBoxBerthRemarks.Visibility = Visibility.Hidden;
break; break;
case ShipcallType.Shifting: case ShipcallType.Shifting:
this.rowStart.Height = new(0); this.rowStart.Height = new(0);
this.labelEnd.FontWeight = FontWeights.Bold;
this.datePickerOperationEnd.ContextMenu.IsEnabled = false;
this.labelBerth.Visibility = Visibility.Hidden; this.labelBerth.Visibility = Visibility.Hidden;
this.comboBoxBerth.Visibility = Visibility.Hidden; this.comboBoxBerth.Visibility = Visibility.Hidden;
this.labelPierside.Visibility = Visibility.Hidden; this.labelPierside.Visibility = Visibility.Hidden;
@ -166,15 +151,8 @@ namespace BreCalClient
this.comboBoxPierside.IsEnabled = ShipcallModel.Shipcall?.Type == ShipcallType.Arrival; this.comboBoxPierside.IsEnabled = ShipcallModel.Shipcall?.Type == ShipcallType.Arrival;
this.textBoxBerthRemarks.IsReadOnly = ShipcallModel.Shipcall?.Type != ShipcallType.Arrival; this.textBoxBerthRemarks.IsReadOnly = ShipcallModel.Shipcall?.Type != ShipcallType.Arrival;
this.textBoxRemarks.IsReadOnly = false; 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 #endregion