Improved on history display, showing type and eta/etd.
Also using a link label style to allow to move overview grid by clicking on the element
This commit is contained in:
parent
a9f80b8f86
commit
d429c0b01a
@ -14,19 +14,26 @@
|
|||||||
<RowDefinition Height="25" />
|
<RowDefinition Height="25" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width=".25*" />
|
<ColumnDefinition Width=".2*" />
|
||||||
<ColumnDefinition Width=".25*" />
|
<ColumnDefinition Width=".2*" />
|
||||||
<ColumnDefinition Width=".25*" />
|
<ColumnDefinition Width=".2*" />
|
||||||
<ColumnDefinition Width=".25*" />
|
<ColumnDefinition Width=".2*" />
|
||||||
|
<ColumnDefinition Width=".2*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Grid.Row="0" Grid.Column="0" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textShip}" VerticalAlignment="Center" Foreground="Gray" />
|
<TextBlock Grid.Row="0" Grid.Column="0" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textShip}" VerticalAlignment="Center" Foreground="Gray" />
|
||||||
<TextBlock Grid.Row="0" Grid.Column="1" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textTimestamp}" VerticalAlignment="Center" Foreground="Gray"/>
|
<TextBlock Grid.Row="0" Grid.Column="1" FontSize="10" FontWeight="DemiBold" VerticalAlignment="Center" x:Name="textBlockShipcallType" />
|
||||||
<TextBlock Grid.Row="0" Grid.Column="2" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textOperation}" VerticalAlignment="Center" Foreground="Gray"/>
|
<TextBlock Grid.Row="0" Grid.Column="2" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textTimestamp}" VerticalAlignment="Center" Foreground="Gray"/>
|
||||||
<TextBlock Grid.Row="0" Grid.Column="3" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textParticipant}" VerticalAlignment="Center" Foreground="Gray"/>
|
<TextBlock Grid.Row="0" Grid.Column="3" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textOperation}" VerticalAlignment="Center" Foreground="Gray"/>
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0" x:Name="textBlockShip" FontWeight="DemiBold" />
|
<TextBlock Grid.Row="0" Grid.Column="4" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textParticipant}" VerticalAlignment="Center" Foreground="Gray"/>
|
||||||
<TextBlock Grid.Row="1" Grid.Column="1" x:Name="textBlockTimestamp" />
|
<TextBlock Grid.Row="1" Grid.Column="0" x:Name="textBlockShip" FontWeight="DemiBold">
|
||||||
<TextBlock Grid.Row="1" Grid.Column="2" x:Name="textBlockOperation" />
|
<Hyperlink Click="textBlockShip_Click">
|
||||||
<TextBlock Grid.Row="1" Grid.Column="3" x:Name="textBlockParticipant" />
|
<TextBlock x:Name="hyperLinkShip" />
|
||||||
|
</Hyperlink>
|
||||||
|
</TextBlock>
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="1" x:Name="textBlockEta" />
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="2" x:Name="textBlockTimestamp" />
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="3" x:Name="textBlockOperation" />
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="4" x:Name="textBlockParticipant" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
using BreCalClient.misc.Model;
|
using BreCalClient.misc.Model;
|
||||||
|
using System;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace BreCalClient
|
namespace BreCalClient
|
||||||
@ -12,16 +13,26 @@ namespace BreCalClient
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class HistoryControl : UserControl
|
public partial class HistoryControl : UserControl
|
||||||
{
|
{
|
||||||
public HistoryControl(string ship, History history)
|
private readonly History _history;
|
||||||
|
public event Action<int>? HistorySelected;
|
||||||
|
|
||||||
|
public HistoryControl(string ship, History history, string callType, string etaetd)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_history = history;
|
||||||
this.textBlockOperation.Text = $"{history.Operation} on {history.Type}";
|
this.textBlockOperation.Text = $"{history.Operation} on {history.Type}";
|
||||||
this.textBlockShip.Text = ship;
|
this.hyperLinkShip.Text = ship;
|
||||||
|
|
||||||
if(BreCalLists.ParticipantLookupDict.ContainsKey(history.ParticipantId))
|
if(BreCalLists.ParticipantLookupDict.ContainsKey(history.ParticipantId))
|
||||||
this.textBlockParticipant.Text = BreCalLists.ParticipantLookupDict[history.ParticipantId].Name;
|
this.textBlockParticipant.Text = BreCalLists.ParticipantLookupDict[history.ParticipantId].Name;
|
||||||
this.textBlockTimestamp.Text = history.Timestamp.ToString();
|
this.textBlockTimestamp.Text = history.Timestamp.ToString();
|
||||||
|
this.textBlockEta.Text = etaetd;
|
||||||
|
this.textBlockShipcallType.Text = callType;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void textBlockShip_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.HistorySelected?.Invoke(_history.ShipcallId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,8 +4,10 @@
|
|||||||
|
|
||||||
using BreCalClient.misc.Api;
|
using BreCalClient.misc.Api;
|
||||||
using BreCalClient.misc.Model;
|
using BreCalClient.misc.Model;
|
||||||
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Printing;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
namespace BreCalClient
|
namespace BreCalClient
|
||||||
@ -22,6 +24,12 @@ namespace BreCalClient
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region delegate/event to react to history item selection
|
||||||
|
|
||||||
|
public event Action<int>? HistoryItemSelected;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Construction
|
#region Construction
|
||||||
|
|
||||||
public HistoryDialog(ConcurrentDictionary<int, ShipcallControlModel> shipcalls, StaticApi staticApi)
|
public HistoryDialog(ConcurrentDictionary<int, ShipcallControlModel> shipcalls, StaticApi staticApi)
|
||||||
@ -69,7 +77,19 @@ namespace BreCalClient
|
|||||||
Ship? ship = this._shipcalls[history.ShipcallId].Ship;
|
Ship? ship = this._shipcalls[history.ShipcallId].Ship;
|
||||||
if (ship != null)
|
if (ship != null)
|
||||||
shipname = ship.Name;
|
shipname = ship.Name;
|
||||||
HistoryControl hc = new(shipname, history);
|
string etaetd = "", calltype = "";
|
||||||
|
if (_shipcalls.ContainsKey(history.ShipcallId))
|
||||||
|
{
|
||||||
|
etaetd = _shipcalls[history.ShipcallId].GetETAETD();
|
||||||
|
if (_shipcalls[history.ShipcallId].Shipcall != null)
|
||||||
|
{
|
||||||
|
ShipcallType? type = _shipcalls[history.ShipcallId].Shipcall?.Type;
|
||||||
|
if (type != null) calltype = type.Value.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HistoryControl hc = new(shipname, history, calltype, etaetd);
|
||||||
|
hc.HistorySelected += (x) => { HistoryItemSelected?.Invoke(x); }; // bubble event
|
||||||
this.stackPanel.Children.Add(hc);
|
this.stackPanel.Children.Add(hc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -357,6 +357,11 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
_historyDialog = new HistoryDialog(_allShipcallsDict, _staticApi);
|
_historyDialog = new HistoryDialog(_allShipcallsDict, _staticApi);
|
||||||
_historyDialog.Closed += (sender, e) => { this._historyDialog = null; };
|
_historyDialog.Closed += (sender, e) => { this._historyDialog = null; };
|
||||||
|
_historyDialog.HistoryItemSelected += (x) =>
|
||||||
|
{
|
||||||
|
if(_allShipCallsControlDict.ContainsKey(x))
|
||||||
|
_allShipCallsControlDict[x].BringIntoView();
|
||||||
|
};
|
||||||
_historyDialog.Show();
|
_historyDialog.Show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -182,6 +182,33 @@ namespace BreCalClient
|
|||||||
return berthText;
|
return berthText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetETAETD()
|
||||||
|
{
|
||||||
|
DateTime theDate = DateTime.Now;
|
||||||
|
if(this.Shipcall != null)
|
||||||
|
{
|
||||||
|
if (this.Shipcall.Type == ShipcallType.Arrival)
|
||||||
|
theDate = this.Shipcall.Eta ?? DateTime.Now;
|
||||||
|
else
|
||||||
|
theDate = this.Shipcall.Etd ?? DateTime.Now;
|
||||||
|
}
|
||||||
|
Times? agentTimes = this.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY);
|
||||||
|
if(agentTimes != null)
|
||||||
|
{
|
||||||
|
if(this.Shipcall?.Type == ShipcallType.Arrival)
|
||||||
|
{
|
||||||
|
if (agentTimes.EtaBerth != null)
|
||||||
|
theDate = agentTimes.EtaBerth.Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (agentTimes.EtdBerth != null)
|
||||||
|
theDate = agentTimes.EtdBerth.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return theDate.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// After closing the edit shipcall or edit agency dialogs, the times assignments may have changed.
|
/// After closing the edit shipcall or edit agency dialogs, the times assignments may have changed.
|
||||||
|
|||||||
Reference in New Issue
Block a user