diff --git a/src/BreCalClient/AboutDialog.xaml b/src/BreCalClient/AboutDialog.xaml
new file mode 100644
index 0000000..b055524
--- /dev/null
+++ b/src/BreCalClient/AboutDialog.xaml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bremer Schiffsmeldedienst
+
+
+
+
+ Informatikbüro Daniel Schick
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BreCalClient/AboutDialog.xaml.cs b/src/BreCalClient/AboutDialog.xaml.cs
new file mode 100644
index 0000000..e560e36
--- /dev/null
+++ b/src/BreCalClient/AboutDialog.xaml.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+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
+{
+ ///
+ /// Interaction logic for AboutDialog.xaml
+ ///
+ public partial class AboutDialog : Window
+ {
+
+ #region Construction
+
+ public AboutDialog()
+ {
+ InitializeComponent();
+ }
+
+ #endregion
+
+ #region events
+
+ public event Action? ChangePasswordRequested;
+
+ #endregion
+
+ #region event handler
+
+ private void buttonClose_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+
+ private void buttonChangePassword_Click(object sender, RoutedEventArgs e)
+ {
+ this.ChangePasswordRequested?.Invoke(this.wpBoxOldPassword.Text, this.wpBoxNewPassword.Text);
+ }
+
+ private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
+ {
+ Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri) { UseShellExecute = true });
+ e.Handled = true;
+ }
+
+ private void wpBoxOldPassword_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ this.buttonChangePassword.IsEnabled =
+ (this.wpBoxOldPassword.Text.Length > 0) &&
+ (this.wpBoxNewPassword.Text.Length > 0) &&
+ (this.wpBoxNewPasswordRepeat.Text.Length > 0) &&
+ (this.wpBoxNewPassword.Text.Equals(this.wpBoxNewPasswordRepeat.Text));
+ }
+
+ #endregion
+
+ }
+}
diff --git a/src/BreCalClient/BreCalClient.csproj b/src/BreCalClient/BreCalClient.csproj
index 3ae3375..2dcf5a8 100644
--- a/src/BreCalClient/BreCalClient.csproj
+++ b/src/BreCalClient/BreCalClient.csproj
@@ -12,6 +12,7 @@
0.3.0.0
Bremen calling client
A Windows WPF client for the Bremen calling API.
+ containership.ico
@@ -22,6 +23,7 @@
+
@@ -50,6 +52,10 @@
+
+
+
+
OpenApiCodeGenerator
@@ -62,6 +68,7 @@
+
diff --git a/src/BreCalClient/EditShipcallControl.xaml b/src/BreCalClient/EditShipcallControl.xaml
index 6566e00..a269c97 100644
--- a/src/BreCalClient/EditShipcallControl.xaml
+++ b/src/BreCalClient/EditShipcallControl.xaml
@@ -8,7 +8,7 @@
xmlns:db="clr-namespace:BreCalClient;assembly=BreCalClient"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
- Title="{x:Static p:Resources.textEditShipcall}" Height="466" Width="800" Loaded="Window_Loaded" ResizeMode="NoResize">
+ Title="{x:Static p:Resources.textEditShipcall}" Height="466" Width="800" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico">
@@ -49,7 +49,7 @@
-
+
@@ -107,7 +107,7 @@
-
+
diff --git a/src/BreCalClient/EditShipcallControl.xaml.cs b/src/BreCalClient/EditShipcallControl.xaml.cs
index ced0f09..b22b005 100644
--- a/src/BreCalClient/EditShipcallControl.xaml.cs
+++ b/src/BreCalClient/EditShipcallControl.xaml.cs
@@ -30,6 +30,8 @@ namespace BreCalClient
InitializeComponent();
}
+ #region Properties
+
public Shipcall Shipcall { get; set; } = new ();
public List Participants { get; set; } = new();
@@ -38,6 +40,10 @@ namespace BreCalClient
public List Ships { get; set; } = new();
+ #endregion
+
+ #region Event handler
+
private void Window_Loaded(object sender, RoutedEventArgs e)
{
List aList = new();
@@ -65,10 +71,13 @@ namespace BreCalClient
this.comboBoxCategories.ItemsSource = Enum.GetValues(typeof(Shipcall.TypeEnum));
this.comboBoxArrivalBerth.ItemsSource = this.Berths;
this.comboBoxDepartureBerth.ItemsSource = this.Berths;
+
+ this.CopyToControls();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
+ this.CopyToModel();
this.DialogResult = true; this.Close();
}
@@ -76,5 +85,48 @@ namespace BreCalClient
{
this.DialogResult= false; this.Close();
}
+
+ private void comboBoxShip_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ this.buttonOK.IsEnabled = this.comboBoxShip.SelectedItem != null;
+ }
+
+ #endregion
+
+ #region private methods
+
+ private void CopyToModel()
+ {
+ this.Shipcall.Type = (Shipcall.TypeEnum)this.comboBoxCategories.SelectedValue;
+ this.Shipcall.Eta = this.datePickerETA.Value ?? DateTime.Now;
+ this.Shipcall.Voyage = this.textBoxVoyage.Text.Trim();
+ this.Shipcall.Etd = this.datePickerETD.Value ?? DateTime.Now.AddDays(1);
+ this.Shipcall.Anchored = this.checkBoxAnchored.IsChecked;
+ this.Shipcall.ShipId = ((Ship)this.comboBoxShip.SelectedItem).Id;
+ this.Shipcall.ArrivalBerthId = (this.comboBoxArrivalBerth.SelectedValue != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedValue).Id : null;
+ this.Shipcall.DepartureBerthId = (this.comboBoxDepartureBerth.SelectedValue != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedValue).Id : null;
+ this.Shipcall.Bunkering = this.checkBoxBunkering.IsChecked;
+ this.Shipcall.Canceled = this.checkBoxCanceled.IsChecked;
+ this.Shipcall.Draft = (float?) this.doubleUpDownDraft.Value;
+ this.Shipcall.MooredLock = this.checkBoxMooredLock.IsChecked;
+ // this.Shipcall.PierSide = this.comboBoxPierside.SelectedValue;
+ this.Shipcall.RainSensitiveCargo = this.checkBoxRainsensitiveCargo.IsChecked;
+ this.Shipcall.PilotRequired = this.checkBoxPilotRequired.IsChecked;
+ this.Shipcall.ReplenishingLock = this.checkBoxReplenishingLock.IsChecked;
+ this.Shipcall.ReplenishingTerminal = this.checkBoxReplenishingTerminal.IsChecked;
+ this.Shipcall.RecommendedTugs = this.integerUpDownRecommendedTugs.Value;
+ this.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
+ this.Shipcall.TidalWindowTo = this.datePickerTidalWindowTo.Value;
+ this.Shipcall.TugReguired = this.checkBoxTugRequired.IsChecked;
+ }
+
+ private void CopyToControls()
+ {
+ if (this.Shipcall == null) return;
+
+ }
+
+ #endregion
+
}
}
diff --git a/src/BreCalClient/MainWindow.xaml b/src/BreCalClient/MainWindow.xaml
index 75f829b..fdc42d4 100644
--- a/src/BreCalClient/MainWindow.xaml
+++ b/src/BreCalClient/MainWindow.xaml
@@ -7,7 +7,7 @@
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:p = "clr-namespace:BreCalClient.Resources"
mc:Ignorable="d"
- Title="{DynamicResource textApplicationTitle}" Height="450" Width="800" Loaded="Window_Loaded" Closing="Window_Closing">
+ Title="{DynamicResource textApplicationTitle}" Height="450" Width="800" Loaded="Window_Loaded" Closing="Window_Closing" Icon="Resources/containership.ico">
@@ -57,8 +57,8 @@
-
-
+
+
@@ -87,9 +87,13 @@
+
+
-
-
+
+
+
+
@@ -101,18 +105,24 @@
-
-
-
+
-
+
-
+
+
+
+
+
+
+
+
+
diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs
index b15167f..ca79547 100644
--- a/src/BreCalClient/MainWindow.xaml.cs
+++ b/src/BreCalClient/MainWindow.xaml.cs
@@ -21,6 +21,9 @@ namespace BreCalClient
///
public partial class MainWindow : Window
{
+
+ #region Fields
+
private const int SHIPCALL_UPDATE_INTERVAL_SECONDS = 30;
private readonly DefaultApi _api;
private readonly ObservableCollection _controlModels = new();
@@ -34,6 +37,21 @@ namespace BreCalClient
private readonly CancellationTokenSource _tokenSource = new();
private LoginResult? _loginResult;
+ #endregion
+
+ #region Enums
+
+ private enum ConnectionStatus
+ {
+ UNDEFINED,
+ SUCCESSFUL,
+ FAILED
+ }
+
+ #endregion
+
+ #region Construction
+
public MainWindow()
{
InitializeComponent();
@@ -41,11 +59,14 @@ namespace BreCalClient
_api.Configuration.ApiKeyPrefix["Authorization"] = "Bearer";
}
+ #endregion
+
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
-
+ labelGeneralStatus.Text = $"Connection {ConnectionStatus.UNDEFINED}";
+ labelVersion.Text = "V. " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
@@ -74,16 +95,20 @@ namespace BreCalClient
this.busyIndicator.IsBusy = false;
this._api.Configuration.ApiKey["Authorization"] = _loginResult.Token;
this.LoadStaticLists();
+ this.labelUsername.Text = $"{_loginResult.FirstName} {_loginResult.LastName}";
}
}
+ labelGeneralStatus.Text = $"Connection {ConnectionStatus.SUCCESSFUL}";
}
catch (ApiException ex)
{
this.labelLoginResult.Content = ex.Message;
+ labelGeneralStatus.Text = $"Connection {ConnectionStatus.FAILED}";
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ labelGeneralStatus.Text = $"Connection {ConnectionStatus.FAILED}";
}
}
@@ -103,12 +128,21 @@ namespace BreCalClient
if (esc.ShowDialog() ?? false)
{
- // create new Shipcall Control
+ // save new dialog model
- // add to list
+ // add dialog model to list
}
}
+ private void buttonInfo_Click(object sender, RoutedEventArgs e)
+ {
+ AboutDialog ad = new();
+ ad.ChangePasswordRequested += (oldPw, newPw) =>
+ {
+
+ };
+ ad.ShowDialog();
+ }
#endregion
@@ -152,7 +186,24 @@ namespace BreCalClient
{
while (!_tokenSource.Token.IsCancellationRequested)
{
- List shipcalls = await _api.ShipcallsGetAsync();
+ List? shipcalls = null;
+ try
+ {
+ shipcalls = await _api.ShipcallsGetAsync();
+ this.Dispatcher.Invoke(new Action(() =>
+ {
+ labelGeneralStatus.Text = $"Connection {ConnectionStatus.SUCCESSFUL}";
+ labelGeneralStatus.Text = $"Ok";
+ }));
+ }
+ catch (Exception ex)
+ {
+ this.Dispatcher.Invoke(new Action(() =>
+ {
+ labelGeneralStatus.Text = $"Connection {ConnectionStatus.FAILED}";
+ labelStatusBar.Text = ex.Message;
+ }));
+ }
if (shipcalls != null)
{
foreach (Shipcall shipcall in shipcalls)
@@ -241,6 +292,6 @@ namespace BreCalClient
}
#endregion
-
+
}
}
diff --git a/src/BreCalClient/Resources/Resources.Designer.cs b/src/BreCalClient/Resources/Resources.Designer.cs
index a6e05ac..c9772c2 100644
--- a/src/BreCalClient/Resources/Resources.Designer.cs
+++ b/src/BreCalClient/Resources/Resources.Designer.cs
@@ -140,6 +140,16 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized resource of type System.Byte[].
+ ///
+ public static byte[] containership1 {
+ get {
+ object obj = ResourceManager.GetObject("containership1", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Byte[].
///
@@ -269,6 +279,33 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Change.
+ ///
+ public static string textChange {
+ get {
+ return ResourceManager.GetString("textChange", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Change password.
+ ///
+ public static string textChangePassword {
+ get {
+ return ResourceManager.GetString("textChangePassword", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Close.
+ ///
+ public static string textClose {
+ get {
+ return ResourceManager.GetString("textClose", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Departure terminal.
///
@@ -377,6 +414,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to New password.
+ ///
+ public static string textNewPassword {
+ get {
+ return ResourceManager.GetString("textNewPassword", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to OK.
///
@@ -386,6 +432,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Old password.
+ ///
+ public static string textOldPassword {
+ get {
+ return ResourceManager.GetString("textOldPassword", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Participants.
///
@@ -449,6 +504,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Repeat new password.
+ ///
+ public static string textRepeatNewPassword {
+ get {
+ return ResourceManager.GetString("textRepeatNewPassword", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Replenishing lock.
///
diff --git a/src/BreCalClient/Resources/Resources.de.resx b/src/BreCalClient/Resources/Resources.de.resx
index 67eab1c..46c1c18 100644
--- a/src/BreCalClient/Resources/Resources.de.resx
+++ b/src/BreCalClient/Resources/Resources.de.resx
@@ -178,6 +178,15 @@
Kategorien
+
+ Ändern
+
+
+ Password ändern
+
+
+ Schliessen
+
Terminal Abfahrt
@@ -214,9 +223,15 @@
Neu..
+
+ Neues Passwort
+
OK
+
+ Altes Passwort
+
Teilnehmer
@@ -238,6 +253,9 @@
Anzahl Schlepper
+
+ Neues Passwort wiederholen
+
Versorgungsaufnahme Schleuse
diff --git a/src/BreCalClient/Resources/Resources.resx b/src/BreCalClient/Resources/Resources.resx
index 4b00555..6208d0f 100644
--- a/src/BreCalClient/Resources/Resources.resx
+++ b/src/BreCalClient/Resources/Resources.resx
@@ -142,6 +142,9 @@
containership.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ containership.ico;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
emergency_stop_button.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
@@ -184,6 +187,15 @@
Categories
+
+ Change
+
+
+ Change password
+
+
+ Close
+
Departure terminal
@@ -220,9 +232,15 @@
New..
+
+ New password
+
OK
+
+ Old password
+
Participants
@@ -244,6 +262,9 @@
Recommended tugs
+
+ Repeat new password
+
Replenishing lock
diff --git a/src/BreCalClient/Resources/containership.ico b/src/BreCalClient/Resources/containership.ico
new file mode 100644
index 0000000..51fbac0
Binary files /dev/null and b/src/BreCalClient/Resources/containership.ico differ
diff --git a/src/BreCalClient/SearchFilterControl.xaml b/src/BreCalClient/SearchFilterControl.xaml
index c122238..bca84da 100644
--- a/src/BreCalClient/SearchFilterControl.xaml
+++ b/src/BreCalClient/SearchFilterControl.xaml
@@ -27,7 +27,7 @@
-