Setup history window, fixed a small bug in the yaml and loaded history entries
This commit is contained in:
parent
54a5b4bb50
commit
e845c919fd
1432
misc/BreCalApi.cs
1432
misc/BreCalApi.cs
File diff suppressed because it is too large
Load Diff
@ -435,6 +435,13 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- static
|
- static
|
||||||
operationId: historyGet
|
operationId: historyGet
|
||||||
|
parameters:
|
||||||
|
- name: shipcall_id
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
description: '**Id of ship call**. *Example: 52*. Id given in ship call list'
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/shipcallId'
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: list of history entries
|
description: list of history entries
|
||||||
|
|||||||
21
src/BreCalClient/HistoryDialog.xaml
Normal file
21
src/BreCalClient/HistoryDialog.xaml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<Window x:Class="BreCalClient.HistoryDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:BreCalClient"
|
||||||
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||||
|
xmlns:p = "clr-namespace:BreCalClient.Resources"
|
||||||
|
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
|
||||||
|
Title="{x:Static p:Resources.textChangeHistory}" Height="450" Width="800" Loaded="Window_Loaded">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" Margin="2">
|
||||||
|
<StackPanel x:Name="stackPanel"/>
|
||||||
|
</ScrollViewer>
|
||||||
|
<Button x:Name="buttonClose" Click="buttonClose_Click" Content="{x:Static p:Resources.textClose}" Width="80" Margin="2" Grid.Row="1" HorizontalAlignment="Right" />
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
76
src/BreCalClient/HistoryDialog.xaml.cs
Normal file
76
src/BreCalClient/HistoryDialog.xaml.cs
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
// Copyright (c) 2023 schick Informatik
|
||||||
|
// Description:
|
||||||
|
//
|
||||||
|
|
||||||
|
using BreCalClient.misc.Api;
|
||||||
|
using BreCalClient.misc.Model;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for HistoryDialog.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class HistoryDialog : Window
|
||||||
|
{
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
private readonly ConcurrentDictionary<int, ShipcallControlModel> _shipcalls;
|
||||||
|
private readonly StaticApi _staticApi;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Construction
|
||||||
|
|
||||||
|
public HistoryDialog(ConcurrentDictionary<int, ShipcallControlModel> shipcalls, StaticApi staticApi)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_shipcalls = shipcalls;
|
||||||
|
_staticApi = staticApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region event handler
|
||||||
|
|
||||||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
RefreshHistory();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonClose_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region private methods
|
||||||
|
|
||||||
|
private async void RefreshHistory()
|
||||||
|
{
|
||||||
|
foreach (int shipcall_id in _shipcalls.Keys)
|
||||||
|
{
|
||||||
|
List<History> shipcallHistory = await _staticApi.HistoryGetAsync(shipcall_id);
|
||||||
|
System.Diagnostics.Trace.WriteLine($"{shipcallHistory.Count} history elements loaded for shipcall {shipcall_id}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -32,7 +32,6 @@ namespace BreCalClient
|
|||||||
public partial class MainWindow : Window
|
public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
private readonly ILog _log = LogManager.GetLogger(typeof(MainWindow));
|
private readonly ILog _log = LogManager.GetLogger(typeof(MainWindow));
|
||||||
|
|
||||||
private const int SHIPCALL_UPDATE_INTERVAL_SECONDS = 30;
|
private const int SHIPCALL_UPDATE_INTERVAL_SECONDS = 30;
|
||||||
private const int PROGRESS_STEPS = 50;
|
private const int PROGRESS_STEPS = 50;
|
||||||
|
|
||||||
@ -50,7 +49,7 @@ namespace BreCalClient
|
|||||||
private readonly UserApi _userApi;
|
private readonly UserApi _userApi;
|
||||||
private readonly TimesApi _timesApi;
|
private readonly TimesApi _timesApi;
|
||||||
private readonly StaticApi _staticApi;
|
private readonly StaticApi _staticApi;
|
||||||
private readonly ShipApi _shipApi;
|
private readonly ShipApi _shipApi;
|
||||||
|
|
||||||
private CancellationTokenSource _tokenSource = new();
|
private CancellationTokenSource _tokenSource = new();
|
||||||
private LoginResult? _loginResult;
|
private LoginResult? _loginResult;
|
||||||
@ -62,6 +61,7 @@ namespace BreCalClient
|
|||||||
|
|
||||||
// private bool _filterChanged = false;
|
// private bool _filterChanged = false;
|
||||||
// private bool _sequenceChanged = false;
|
// private bool _sequenceChanged = false;
|
||||||
|
private HistoryDialog? _historyDialog;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -353,7 +353,16 @@ namespace BreCalClient
|
|||||||
|
|
||||||
private void buttonHistory_Click(object sender, RoutedEventArgs e)
|
private void buttonHistory_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if(_historyDialog == null)
|
||||||
|
{
|
||||||
|
_historyDialog = new HistoryDialog(_allShipcallsDict, _staticApi);
|
||||||
|
_historyDialog.Closed += (sender, e) => { this._historyDialog = null; };
|
||||||
|
_historyDialog.Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_historyDialog.Activate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
9
src/BreCalClient/Resources/Resources.Designer.cs
generated
9
src/BreCalClient/Resources/Resources.Designer.cs
generated
@ -384,6 +384,15 @@ namespace BreCalClient.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Change history.
|
||||||
|
/// </summary>
|
||||||
|
public static string textChangeHistory {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textChangeHistory", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Change password.
|
/// Looks up a localized string similar to Change password.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -448,6 +448,9 @@
|
|||||||
<data name="textTugCompany" xml:space="preserve">
|
<data name="textTugCompany" xml:space="preserve">
|
||||||
<value>Schlepper-Reederei</value>
|
<value>Schlepper-Reederei</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="textChangeHistory" xml:space="preserve">
|
||||||
|
<value>Verlauf</value>
|
||||||
|
</data>
|
||||||
<data name="textInfoChangePW" xml:space="preserve">
|
<data name="textInfoChangePW" xml:space="preserve">
|
||||||
<value>App Info anzeigen und Passwort ändern</value>
|
<value>App Info anzeigen und Passwort ändern</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@ -220,6 +220,9 @@
|
|||||||
<data name="textChangeContactInfo" xml:space="preserve">
|
<data name="textChangeContactInfo" xml:space="preserve">
|
||||||
<value>Update contact info</value>
|
<value>Update contact info</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="textChangeHistory" xml:space="preserve">
|
||||||
|
<value>Change history</value>
|
||||||
|
</data>
|
||||||
<data name="textChangePassword" xml:space="preserve">
|
<data name="textChangePassword" xml:space="preserve">
|
||||||
<value>Change password</value>
|
<value>Change password</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
Reference in New Issue
Block a user