Change history Part 3
Finished layout of history control, reversed sort order (newest on top) May need to move labels to HistoryDialog
This commit is contained in:
parent
e845c919fd
commit
32296f7d15
@ -1,12 +1,12 @@
|
|||||||
extensions: designer.cs generated.cs
|
extensions: designer.cs generated.cs
|
||||||
extensions: .cs .cpp .h
|
extensions: .cs .cpp .h
|
||||||
// Copyright (c) 2023 schick Informatik
|
// Copyright (c) 2024- schick Informatik
|
||||||
// Description:
|
// Description:
|
||||||
//
|
//
|
||||||
|
|
||||||
extensions: .aspx .ascx
|
extensions: .aspx .ascx
|
||||||
<%--
|
<%--
|
||||||
Copyright (c) 2023 schick Informatik
|
Copyright (c) 2024- schick Informatik
|
||||||
--%>
|
--%>
|
||||||
extensions: .vb
|
extensions: .vb
|
||||||
'Sample license text.
|
'Sample license text.
|
||||||
|
|||||||
32
src/BreCalClient/HistoryControl.xaml
Normal file
32
src/BreCalClient/HistoryControl.xaml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<UserControl x:Class="BreCalClient.HistoryControl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:BreCalClient"
|
||||||
|
xmlns:p = "clr-namespace:BreCalClient.Resources"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="46" d:DesignWidth="800">
|
||||||
|
<Border BorderBrush="Black" BorderThickness="0 0 0 .5">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="14" />
|
||||||
|
<RowDefinition Height="25" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width=".25*" />
|
||||||
|
<ColumnDefinition Width=".25*" />
|
||||||
|
<ColumnDefinition Width=".25*" />
|
||||||
|
<ColumnDefinition Width=".25*" />
|
||||||
|
</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="1" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textTimestamp}" VerticalAlignment="Center" Foreground="Gray"/>
|
||||||
|
<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="3" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textParticipant}" VerticalAlignment="Center" Foreground="Gray"/>
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="0" x:Name="textBlockShip" FontWeight="DemiBold" />
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="1" x:Name="textBlockTimestamp" />
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="2" x:Name="textBlockOperation" />
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="3" x:Name="textBlockParticipant" />
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</UserControl>
|
||||||
27
src/BreCalClient/HistoryControl.xaml.cs
Normal file
27
src/BreCalClient/HistoryControl.xaml.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (c) 2024- schick Informatik
|
||||||
|
// Description: display single history element (later shown in a list)
|
||||||
|
//
|
||||||
|
|
||||||
|
using BreCalClient.misc.Model;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace BreCalClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for HistoryControl.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class HistoryControl : UserControl
|
||||||
|
{
|
||||||
|
public HistoryControl(string ship, History history)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.textBlockOperation.Text = $"{history.Operation} on {history.Type}";
|
||||||
|
this.textBlockShip.Text = ship;
|
||||||
|
if(BreCalLists.ParticipantLookupDict.ContainsKey(history.ParticipantId))
|
||||||
|
this.textBlockParticipant.Text = BreCalLists.ParticipantLookupDict[history.ParticipantId].Name;
|
||||||
|
this.textBlockTimestamp.Text = history.Timestamp.ToString();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,23 +1,12 @@
|
|||||||
// Copyright (c) 2023 schick Informatik
|
// Copyright (c) 2024- schick Informatik
|
||||||
// Description:
|
// Description: Window to show (complete) list of current shipcall histories
|
||||||
//
|
//
|
||||||
|
|
||||||
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.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace BreCalClient
|
namespace BreCalClient
|
||||||
{
|
{
|
||||||
@ -62,10 +51,26 @@ namespace BreCalClient
|
|||||||
|
|
||||||
private async void RefreshHistory()
|
private async void RefreshHistory()
|
||||||
{
|
{
|
||||||
|
List<History> allHistories = new();
|
||||||
foreach (int shipcall_id in _shipcalls.Keys)
|
foreach (int shipcall_id in _shipcalls.Keys)
|
||||||
{
|
{
|
||||||
List<History> shipcallHistory = await _staticApi.HistoryGetAsync(shipcall_id);
|
List<History> shipcallHistory = await _staticApi.HistoryGetAsync(shipcall_id);
|
||||||
System.Diagnostics.Trace.WriteLine($"{shipcallHistory.Count} history elements loaded for shipcall {shipcall_id}");
|
System.Diagnostics.Trace.WriteLine($"{shipcallHistory.Count} history elements loaded for shipcall {shipcall_id}");
|
||||||
|
allHistories.AddRange( shipcallHistory );
|
||||||
|
}
|
||||||
|
|
||||||
|
// sort all entries
|
||||||
|
allHistories.Sort((x, y) => { return y.Timestamp.CompareTo(x.Timestamp); });
|
||||||
|
|
||||||
|
// create controls for all entries
|
||||||
|
foreach (History history in allHistories)
|
||||||
|
{
|
||||||
|
string shipname = "";
|
||||||
|
Ship? ship = this._shipcalls[history.ShipcallId].Ship;
|
||||||
|
if (ship != null)
|
||||||
|
shipname = ship.Name;
|
||||||
|
HistoryControl hc = new(shipname, history);
|
||||||
|
this.stackPanel.Children.Add(hc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
27
src/BreCalClient/Resources/Resources.Designer.cs
generated
27
src/BreCalClient/Resources/Resources.Designer.cs
generated
@ -717,6 +717,15 @@ namespace BreCalClient.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Operation.
|
||||||
|
/// </summary>
|
||||||
|
public static string textOperation {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textOperation", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Operations end.
|
/// Looks up a localized string similar to Operations end.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -744,6 +753,15 @@ namespace BreCalClient.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Participant.
|
||||||
|
/// </summary>
|
||||||
|
public static string textParticipant {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textParticipant", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Participants.
|
/// Looks up a localized string similar to Participants.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -987,6 +1005,15 @@ namespace BreCalClient.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Timestamp.
|
||||||
|
/// </summary>
|
||||||
|
public static string textTimestamp {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textTimestamp", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to to.
|
/// Looks up a localized string similar to to.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -457,4 +457,13 @@
|
|||||||
<data name="textShowHistory" xml:space="preserve">
|
<data name="textShowHistory" xml:space="preserve">
|
||||||
<value>Änderungshistorie der Anläufe anzeigen</value>
|
<value>Änderungshistorie der Anläufe anzeigen</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="textOperation" xml:space="preserve">
|
||||||
|
<value>Vorgang</value>
|
||||||
|
</data>
|
||||||
|
<data name="textParticipant" xml:space="preserve">
|
||||||
|
<value>Teilnehmer</value>
|
||||||
|
</data>
|
||||||
|
<data name="textTimestamp" xml:space="preserve">
|
||||||
|
<value>Zeitpunkt</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@ -331,6 +331,9 @@
|
|||||||
<data name="textOldPassword" xml:space="preserve">
|
<data name="textOldPassword" xml:space="preserve">
|
||||||
<value>Old password</value>
|
<value>Old password</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="textOperation" xml:space="preserve">
|
||||||
|
<value>Operation</value>
|
||||||
|
</data>
|
||||||
<data name="textOperationsEnd" xml:space="preserve">
|
<data name="textOperationsEnd" xml:space="preserve">
|
||||||
<value>Operations end</value>
|
<value>Operations end</value>
|
||||||
</data>
|
</data>
|
||||||
@ -340,6 +343,9 @@
|
|||||||
<data name="textOutgoing" xml:space="preserve">
|
<data name="textOutgoing" xml:space="preserve">
|
||||||
<value>Outgoing</value>
|
<value>Outgoing</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="textParticipant" xml:space="preserve">
|
||||||
|
<value>Participant</value>
|
||||||
|
</data>
|
||||||
<data name="textParticipants" xml:space="preserve">
|
<data name="textParticipants" xml:space="preserve">
|
||||||
<value>Participants</value>
|
<value>Participants</value>
|
||||||
</data>
|
</data>
|
||||||
@ -421,6 +427,9 @@
|
|||||||
<data name="textTidalWindow" xml:space="preserve">
|
<data name="textTidalWindow" xml:space="preserve">
|
||||||
<value>Tidal window</value>
|
<value>Tidal window</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="textTimestamp" xml:space="preserve">
|
||||||
|
<value>Timestamp</value>
|
||||||
|
</data>
|
||||||
<data name="textTo" xml:space="preserve">
|
<data name="textTo" xml:space="preserve">
|
||||||
<value>to</value>
|
<value>to</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user