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*" />
|
||||||
<ColumnDefinition Width=".5*" />
|
<ColumnDefinition Width=".5*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<ComboBox Name="comboBoxArrivalBerth" Grid.Column="0" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
|
<ComboBox Name="comboBoxArrivalBerth" Grid.Column="0" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxArrivalBerth_SelectionChanged"/>
|
||||||
<ComboBox.ContextMenu>
|
|
||||||
<ContextMenu>
|
<ComboBox Name="comboBoxDepartureBerth" Grid.Column="1" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxDepartureBerth_SelectionChanged"/>
|
||||||
<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>
|
|
||||||
</Grid>
|
</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="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"/>
|
<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"/>
|
<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">
|
<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)
|
private void comboBoxShip_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
this.buttonOK.IsEnabled = this.comboBoxShip.SelectedItem != null;
|
|
||||||
if (this.comboBoxShip.SelectedItem != null)
|
if (this.comboBoxShip.SelectedItem != null)
|
||||||
{
|
{
|
||||||
Ship? ship = this.comboBoxShip.SelectedItem as Ship;
|
Ship? ship = this.comboBoxShip.SelectedItem as Ship;
|
||||||
@ -83,11 +82,13 @@ namespace BreCalClient
|
|||||||
this.doubleUpDownLength.Value = null;
|
this.doubleUpDownLength.Value = null;
|
||||||
this.doubleUpDownWidth.Value = null;
|
this.doubleUpDownWidth.Value = null;
|
||||||
}
|
}
|
||||||
|
this.CheckForCompletion();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void comboBoxAgency_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void comboBoxAgency_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
this.EnableControls();
|
this.EnableControls();
|
||||||
|
this.CheckForCompletion();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void comboBoxCategories_SelectionChanged(object? sender, SelectionChangedEventArgs? e)
|
private void comboBoxCategories_SelectionChanged(object? sender, SelectionChangedEventArgs? e)
|
||||||
@ -121,6 +122,7 @@ namespace BreCalClient
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.CheckForCompletion();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -132,22 +134,24 @@ namespace BreCalClient
|
|||||||
this.comboBoxAgency.SelectedIndex = -1;
|
this.comboBoxAgency.SelectedIndex = -1;
|
||||||
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.AGENCY);
|
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
|
#endregion
|
||||||
|
|
||||||
#region private methods
|
#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()
|
private void CopyToModel()
|
||||||
{
|
{
|
||||||
if (this.ShipcallModel.Shipcall != null)
|
if (this.ShipcallModel.Shipcall != null)
|
||||||
@ -292,5 +296,24 @@ namespace BreCalClient
|
|||||||
|
|
||||||
#endregion
|
#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" />
|
<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" />
|
<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="*"/>
|
<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="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" />
|
<Button Name="buttonExit" Content="{x:Static p:Resources.textExit}" Grid.Row="4" Grid.Column="1" Margin="2" Click="buttonExit_Click" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@ -17,6 +17,8 @@ using BreCalClient.misc.Model;
|
|||||||
|
|
||||||
using static BreCalClient.Extensions;
|
using static BreCalClient.Extensions;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Security.Principal;
|
||||||
|
|
||||||
namespace BreCalClient
|
namespace BreCalClient
|
||||||
{
|
{
|
||||||
@ -129,7 +131,13 @@ namespace BreCalClient
|
|||||||
}
|
}
|
||||||
catch (ApiException ex)
|
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}";
|
labelGeneralStatus.Text = $"Connection {ConnectionStatus.FAILED}";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
Reference in New Issue
Block a user