Trenz map thumbnails in last column

This commit is contained in:
Daniel Schick 2025-05-09 08:15:09 +02:00
parent c3d8e901c4
commit 9ebc723c76
7 changed files with 47 additions and 1 deletions

View File

@ -119,6 +119,7 @@
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.6.1" /> <PackageReference Include="Extended.Wpf.Toolkit" Version="4.6.1" />
<PackageReference Include="JsonSubTypes" Version="2.0.1" /> <PackageReference Include="JsonSubTypes" Version="2.0.1" />
<PackageReference Include="log4net" Version="2.0.17" /> <PackageReference Include="log4net" Version="2.0.17" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3179.45" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Polly" Version="8.4.1" /> <PackageReference Include="Polly" Version="8.4.1" />
<PackageReference Include="RestSharp" Version="112.0.0" /> <PackageReference Include="RestSharp" Version="112.0.0" />

View File

@ -97,6 +97,7 @@
<ColumnDefinition Width=".15*" /> <ColumnDefinition Width=".15*" />
<ColumnDefinition Width=".15*" /> <ColumnDefinition Width=".15*" />
<ColumnDefinition Width=".15*" /> <ColumnDefinition Width=".15*" />
<ColumnDefinition Width=".15*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Grid.Column="0" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label> <Label Grid.Column="0" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
<Label Grid.Column="1" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textAgency}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label> <Label Grid.Column="1" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textAgency}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
@ -105,6 +106,7 @@
<Label Grid.Column="4" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textPilots}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label> <Label Grid.Column="4" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textPilots}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
<Label Grid.Column="5" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textTug}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label> <Label Grid.Column="5" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textTug}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
<Label Grid.Column="6" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textTerminal}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label> <Label Grid.Column="6" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textTerminal}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
<Label Grid.Column="7" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textPosition}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
</Grid> </Grid>
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Auto"> <ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Auto">
<StackPanel x:Name="stackPanel"/> <StackPanel x:Name="stackPanel"/>

View File

@ -1064,6 +1064,15 @@ namespace BreCalClient.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Position.
/// </summary>
public static string textPosition {
get {
return ResourceManager.GetString("textPosition", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Rain sensitive cargo. /// Looks up a localized string similar to Rain sensitive cargo.
/// </summary> /// </summary>

View File

@ -556,4 +556,7 @@
<data name="textNoPortAssigned" xml:space="preserve"> <data name="textNoPortAssigned" xml:space="preserve">
<value>Es ist keine Hafenzuordnung vorhanden</value> <value>Es ist keine Hafenzuordnung vorhanden</value>
</data> </data>
<data name="textPosition" xml:space="preserve">
<value>Position</value>
</data>
</root> </root>

View File

@ -604,4 +604,7 @@
<data name="textNoPortAssigned" xml:space="preserve"> <data name="textNoPortAssigned" xml:space="preserve">
<value>No port assigned to this participant</value> <value>No port assigned to this participant</value>
</data> </data>
<data name="textPosition" xml:space="preserve">
<value>Position</value>
</data>
</root> </root>

View File

@ -18,6 +18,7 @@
<ColumnDefinition Width=".15*" /> <ColumnDefinition Width=".15*" />
<ColumnDefinition Width=".15*" /> <ColumnDefinition Width=".15*" />
<ColumnDefinition Width=".15*" /> <ColumnDefinition Width=".15*" />
<ColumnDefinition Width=".15*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="42" /> <RowDefinition Height="42" />
@ -281,6 +282,10 @@
<TextBlock Grid.Row="3" Grid.Column="1" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockTerminalBerthRemarks" FontSize="10"/> <TextBlock Grid.Row="3" Grid.Column="1" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockTerminalBerthRemarks" FontSize="10"/>
</Grid> </Grid>
</Border> </Border>
<!-- TERMINAL -->
<Border Grid.Row="0" Grid.RowSpan="3" Grid.Column="7" BorderThickness="1, 0, 0, 0" BorderBrush="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Padding="3,0,0,0">
<Grid x:Name="placeHolderMap" />
</Border>
</Grid> </Grid>
</Border> </Border>
</UserControl> </UserControl>

View File

@ -4,6 +4,7 @@
using BreCalClient.misc.Model; using BreCalClient.misc.Model;
using log4net; using log4net;
using Microsoft.Web.WebView2.Wpf;
using System; using System;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
@ -26,6 +27,7 @@ namespace BreCalClient
Participant? _tug; Participant? _tug;
Participant? _port_administration; Participant? _port_administration;
private static readonly ILog _log = LogManager.GetLogger(typeof(ShipcallControl)); private static readonly ILog _log = LogManager.GetLogger(typeof(ShipcallControl));
private WebView2? _webView = null;
#endregion #endregion
@ -59,7 +61,7 @@ namespace BreCalClient
#region public methods #region public methods
public void RefreshData() public async void RefreshData()
{ {
try try
{ {
@ -508,6 +510,27 @@ namespace BreCalClient
} }
this.DataContext = this.ShipcallControlModel; this.DataContext = this.ShipcallControlModel;
// initialize Map if eta is close to current time
DateTime? refTime = (this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Arrival) ? this.ShipcallControlModel?.Eta : this.ShipcallControlModel?.Etd;
if (refTime.HasValue)
{
if ((refTime.Value > DateTime.Now.AddDays(-1)) && refTime.Value < DateTime.Now.AddDays(2))
{
if(this._webView == null)
{
_webView = new WebView2();
string trenzUri = $"https://aismap.trenz.de/Live/StaticDemo.aspx?site=bsmd&Zoom=13&api=usgPcOPJnvTWUPTVbfVs&apikey=demo-H6cE4SG0FG&imo={this.ShipcallControlModel?.Ship?.Imo}";
await Dispatcher.InvokeAsync(() => {
this.placeHolderMap.Children.Add(_webView);
_webView.EnsureCoreWebView2Async(null);
_webView.Source = new Uri(trenzUri);
});
}
}
}
} }
} }
catch (Exception ex) catch (Exception ex)