fixed creating new shipcalls and cleaned up logon error message display
This commit is contained in:
parent
5c6d41470c
commit
56ade40aef
@ -65,24 +65,15 @@
|
||||
<ColumnDefinition Width=".5*" />
|
||||
<ColumnDefinition Width=".5*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox Name="comboBoxArrivalBerth" Grid.Column="0" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
|
||||
<ComboBox.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemDepartureBerth" Click="contextMenuItemDepartureBerth_Click" />
|
||||
</ContextMenu>
|
||||
</ComboBox.ContextMenu>
|
||||
</ComboBox>
|
||||
<ComboBox Name="comboBoxDepartureBerth" Grid.Column="1" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
|
||||
<ComboBox.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemArrivalBerth" Click="contextMenuItemArrivalBerth_Click" />
|
||||
</ContextMenu>
|
||||
</ComboBox.ContextMenu>
|
||||
</ComboBox>
|
||||
<ComboBox Name="comboBoxArrivalBerth" Grid.Column="0" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxArrivalBerth_SelectionChanged"/>
|
||||
|
||||
<ComboBox Name="comboBoxDepartureBerth" Grid.Column="1" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxDepartureBerth_SelectionChanged"/>
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
<xctk:DateTimePicker x:Name="datePickerETA" Grid.Column="3" Grid.Row="2" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False"/>
|
||||
<xctk:DateTimePicker x:Name="datePickerETD" Grid.Column="3" Grid.Row="3" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False"/>
|
||||
<xctk:DateTimePicker x:Name="datePickerETA" Grid.Column="3" Grid.Row="2" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False" ValueChanged="datePickerETA_ValueChanged"/>
|
||||
<xctk:DateTimePicker x:Name="datePickerETD" Grid.Column="3" Grid.Row="3" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False" ValueChanged="datePickerETD_ValueChanged"/>
|
||||
|
||||
<Label Content="{x:Static p:Resources.textAgency}" Grid.Column="2" Grid.Row="4" HorizontalContentAlignment="Right"/>
|
||||
<ComboBox Name="comboBoxAgency" Grid.Column="3" Grid.Row="4" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxAgency_SelectionChanged">
|
||||
|
||||
@ -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<object> e)
|
||||
{
|
||||
this.CheckForCompletion();
|
||||
}
|
||||
|
||||
private void datePickerETD_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
||||
{
|
||||
this.CheckForCompletion();
|
||||
}
|
||||
|
||||
private void comboBoxArrivalBerth_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
this.CheckForCompletion();
|
||||
}
|
||||
|
||||
private void comboBoxDepartureBerth_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
this.CheckForCompletion();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
<Label Content="{x:Static p:Resources.textPassword}" Grid.Row="2" VerticalContentAlignment="Center" />
|
||||
<TextBox Name="textUsername" Grid.Row="1" Grid.Column="1" Margin="2" VerticalContentAlignment="Center" />
|
||||
<PasswordBox Name="textPassword" Grid.Row="2" Grid.Column="1" Margin="2" VerticalContentAlignment="Center" PasswordChar="*"/>
|
||||
<Label Name="labelLoginResult" Grid.Row="3" Grid.ColumnSpan="2" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
|
||||
<Label Name="labelLoginResult" Grid.Row="3" Grid.ColumnSpan="2" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontWeight="Bold" />
|
||||
<Button Name="buttonLogin" Content="{x:Static p:Resources.textLogin}" Grid.Row="4" Grid.Column="0" Margin="2" Click="buttonLogin_Click" IsDefault="True" />
|
||||
<Button Name="buttonExit" Content="{x:Static p:Resources.textExit}" Grid.Row="4" Grid.Column="1" Margin="2" Click="buttonExit_Click" />
|
||||
</Grid>
|
||||
|
||||
@ -17,6 +17,8 @@ using BreCalClient.misc.Model;
|
||||
|
||||
using static BreCalClient.Extensions;
|
||||
using System.Collections.Concurrent;
|
||||
using Newtonsoft.Json;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace BreCalClient
|
||||
{
|
||||
@ -129,7 +131,13 @@ namespace BreCalClient
|
||||
}
|
||||
catch (ApiException ex)
|
||||
{
|
||||
this.labelLoginResult.Content = ex.Message;
|
||||
if ((ex.ErrorContent != null && ((string)ex.ErrorContent).StartsWith("{"))) {
|
||||
Error? anError = JsonConvert.DeserializeObject<Error>((string)ex.ErrorContent);
|
||||
this.labelLoginResult.Content = anError?.Message ?? ex.Message;
|
||||
}
|
||||
else {
|
||||
this.labelLoginResult.Content = ex.Message;
|
||||
}
|
||||
labelGeneralStatus.Text = $"Connection {ConnectionStatus.FAILED}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user