upped the UI some

This commit is contained in:
Daniel Schick 2023-08-24 07:50:12 +02:00
parent f5b79d5d63
commit ef07764915
3 changed files with 32 additions and 19 deletions

View File

@ -72,6 +72,14 @@ namespace BreCalClient
return value.Length <= maxLength ? value : value.Substring(0, maxLength); return value.Length <= maxLength ? value : value.Substring(0, maxLength);
} }
public static string TruncateDots(this string value, int maxLength)
{
if(string.IsNullOrEmpty(value)) return value;
if (value.Length <= maxLength) return value;
if (value.Length > (maxLength + 1)) return $"{value.Substring(0, maxLength)}..";
return value.Substring(0, maxLength);
}
#endregion #endregion
} }

View File

@ -49,40 +49,40 @@
<Label Grid.Column="1" FontSize="12" x:Name="labelShipName" Foreground="White" Background="#203864" VerticalAlignment="Stretch" <Label Grid.Column="1" FontSize="12" x:Name="labelShipName" Foreground="White" Background="#203864" VerticalAlignment="Stretch"
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewMouseUp="Image_PreviewMouseUp"/> HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewMouseUp="Image_PreviewMouseUp"/>
</Grid> </Grid>
<Viewbox Grid.Row="1" Grid.Column="0"> <Viewbox Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left">
<TextBlock Text="IMO" /> <TextBlock Text="IMO" />
</Viewbox> </Viewbox>
<Viewbox Grid.Row="1" Grid.Column="1"> <Viewbox Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left">
<TextBlock x:Name="textBlockIMO" /> <TextBlock x:Name="textBlockIMO" Padding="0" FontWeight="DemiBold" />
</Viewbox> </Viewbox>
<Viewbox Grid.Row="2" Grid.Column="0"> <Viewbox Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left">
<TextBlock Text="{x:Static p:Resources.textCallsign}" /> <TextBlock Text="{x:Static p:Resources.textCallsign}" />
</Viewbox> </Viewbox>
<Viewbox Grid.Row="2" Grid.Column="1"> <Viewbox Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left">
<TextBlock x:Name="textBlockCallsign" /> <TextBlock x:Name="textBlockCallsign" Padding="0"/>
</Viewbox> </Viewbox>
<Viewbox Grid.Row="3" Grid.Column="0"> <Viewbox Grid.Row="3" Grid.Column="0" HorizontalAlignment="Left">
<TextBlock Text="{x:Static p:Resources.textLengthWidth}" /> <TextBlock Text="{x:Static p:Resources.textLengthWidth}" Padding="0" />
</Viewbox> </Viewbox>
<Viewbox Grid.Row="3" Grid.Column="1"> <Viewbox Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left">
<TextBlock x:Name="textBlockLengthWidth" /> <TextBlock x:Name="textBlockLengthWidth" Padding="0"/>
</Viewbox> </Viewbox>
<Viewbox Grid.Row="5" Grid.Column="0"> <Viewbox Grid.Row="5" Grid.Column="0" HorizontalAlignment="Left">
<TextBlock Text="ETA" x:Name="labelETA"/> <TextBlock Text="ETA" x:Name="labelETA"/>
</Viewbox> </Viewbox>
<Viewbox Grid.Row="5" Grid.Column="1"> <Viewbox Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left">
<TextBlock x:Name="textBlockETA" /> <TextBlock x:Name="textBlockETA" />
</Viewbox> </Viewbox>
<Viewbox Grid.Row="6" Grid.Column="0"> <Viewbox Grid.Row="6" Grid.Column="0" HorizontalAlignment="Left">
<TextBlock Text="{x:Static p:Resources.textBerth}" /> <TextBlock Text="{x:Static p:Resources.textBerth}" />
</Viewbox> </Viewbox>
<Viewbox Grid.Row="6" Grid.Column="1"> <Viewbox Grid.Row="6" Grid.Column="1" HorizontalAlignment="Left">
<TextBlock x:Name="textBlockBerth" /> <TextBlock x:Name="textBlockBerth" />
</Viewbox> </Viewbox>
<Viewbox Grid.Row="7" Grid.Column="0"> <Viewbox Grid.Row="7" Grid.Column="0" HorizontalAlignment="Left">
<TextBlock Text="{x:Static p:Resources.textAgency}" /> <TextBlock Text="{x:Static p:Resources.textAgency}" />
</Viewbox> </Viewbox>
<Viewbox Grid.Row="7" Grid.Column="1"> <Viewbox Grid.Row="7" Grid.Column="1" HorizontalAlignment="Left">
<TextBlock x:Name="textBlockAgency" /> <TextBlock x:Name="textBlockAgency" />
</Viewbox> </Viewbox>

View File

@ -56,10 +56,14 @@ namespace BreCalClient
public void RefreshData() public void RefreshData()
{ {
if (this.ShipcallControlModel == null) return; if (this.ShipcallControlModel == null) return;
string agentName = "";
string? name; string? name;
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.AGENCY); name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.AGENCY);
if (name != null) if (name != null)
{
this.labelAgent.Content = name; this.labelAgent.Content = name;
agentName = name;
}
name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.MOORING); name = this.ShipcallControlModel.GetParticipantNameForType(Extensions.ParticipantType.MOORING);
if (name != null) if (name != null)
this.labelMooring.Content = name; this.labelMooring.Content = name;
@ -126,16 +130,17 @@ namespace BreCalClient
this.textBlockCallsign.Text = this.ShipcallControlModel?.Ship?.Callsign; this.textBlockCallsign.Text = this.ShipcallControlModel?.Ship?.Callsign;
if ((this.ShipcallControlModel?.Shipcall?.Type == 1) || (this.ShipcallControlModel?.Shipcall?.Type == 3)) if ((this.ShipcallControlModel?.Shipcall?.Type == 1) || (this.ShipcallControlModel?.Shipcall?.Type == 3))
{ {
this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Eta.ToString(); this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Eta.ToString("dd.MM. HH:mm");
} }
if(this.ShipcallControlModel?.Shipcall?.Type == 2) if(this.ShipcallControlModel?.Shipcall?.Type == 2)
{ {
this.labelETA.Text = "ETD"; this.labelETA.Text = "ETD";
this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Etd.ToString(); this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Etd?.ToString("dd.MM. HH:mm");
} }
this.textBlockIMO.Text = this.ShipcallControlModel?.Ship?.Imo.ToString(); this.textBlockIMO.Text = this.ShipcallControlModel?.Ship?.Imo.ToString();
this.textBlockLengthWidth.Text = $"{this.ShipcallControlModel?.Ship?.Length} / {this.ShipcallControlModel?.Ship?.Width}"; this.textBlockLengthWidth.Text = $"{this.ShipcallControlModel?.Ship?.Length} / {this.ShipcallControlModel?.Ship?.Width}";
this.textBlockAgency.Text = agentName.TruncateDots(10);
if (this.ParticipantDict != null) if (this.ParticipantDict != null)
{ {