diff --git a/misc/BreCalApi.cs b/misc/BreCalApi.cs
index 5494860..9013f76 100644
--- a/misc/BreCalApi.cs
+++ b/misc/BreCalApi.cs
@@ -1,8 +1,8 @@
//----------------------
//
-// Generated REST API Client Code Generator v1.16.0.0 on 10.12.2024 08:56:03
-// Using the tool OpenAPI Generator v7.9.0
+// Generated REST API Client Code Generator v1.17.0.0 on 19.12.2024 11:34:56
+// Using the tool OpenAPI Generator v7.10.0
//
//----------------------
@@ -3829,7 +3829,7 @@ namespace BreCalClient.misc.Client
if (response.Headers != null)
{
var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath)
- ? Path.GetTempPath()
+ ? global::System.IO.Path.GetTempPath()
: _configuration.TempFolderPath;
var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$");
foreach (var header in response.Headers)
@@ -4069,7 +4069,7 @@ namespace BreCalClient.misc.Client
var bytes = ClientUtils.ReadAsBytes(file);
var fileStream = file as FileStream;
if (fileStream != null)
- request.AddFile(fileParam.Key, bytes, Path.GetFileName(fileStream.Name));
+ request.AddFile(fileParam.Key, bytes, global::System.IO.Path.GetFileName(fileStream.Name));
else
request.AddFile(fileParam.Key, bytes, "no_file_name_provided");
}
@@ -4139,7 +4139,7 @@ namespace BreCalClient.misc.Client
var clientOptions = new RestClientOptions(baseUrl)
{
ClientCertificates = configuration.ClientCertificates,
- MaxTimeout = configuration.Timeout,
+ Timeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
UseDefaultCredentials = configuration.UseDefaultCredentials,
@@ -4209,11 +4209,11 @@ namespace BreCalClient.misc.Client
return result;
}
}
- private RestResponse DeserializeRestResponseFromPolicy(RestClient client, RestRequest request, PolicyResult policyResult)
+ private async Task> DeserializeRestResponseFromPolicyAsync(RestClient client, RestRequest request, PolicyResult policyResult, CancellationToken cancellationToken = default)
{
if (policyResult.Outcome == OutcomeType.Successful)
{
- return client.Deserialize(policyResult.Result);
+ return await client.Deserialize(policyResult.Result, cancellationToken);
}
else
{
@@ -4243,7 +4243,7 @@ namespace BreCalClient.misc.Client
{
var policy = RetryConfiguration.RetryPolicy;
var policyResult = policy.ExecuteAndCapture(() => client.Execute(request));
- return Task.FromResult(DeserializeRestResponseFromPolicy(client, request, policyResult));
+ return DeserializeRestResponseFromPolicyAsync(client, request, policyResult);
}
else
{
@@ -4264,7 +4264,7 @@ namespace BreCalClient.misc.Client
{
var policy = RetryConfiguration.AsyncRetryPolicy;
var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false);
- return DeserializeRestResponseFromPolicy(client, request, policyResult);
+ return await DeserializeRestResponseFromPolicyAsync(client, request, policyResult, cancellationToken);
}
else
{
@@ -5000,7 +5000,7 @@ namespace BreCalClient.misc.Client
{
};
// Setting Timeout has side effects (forces ApiClient creation).
- Timeout = 100000;
+ Timeout = TimeSpan.FromSeconds(100);
}
///
/// Initializes a new instance of the class
@@ -5072,9 +5072,9 @@ namespace BreCalClient.misc.Client
///
public virtual IDictionary DefaultHeaders { get; set; }
///
- /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
+ /// Gets or sets the HTTP timeout of ApiClient. Defaults to 100 seconds.
///
- public virtual int Timeout { get; set; }
+ public virtual TimeSpan Timeout { get; set; }
///
/// Gets or sets the proxy
///
@@ -5713,10 +5713,10 @@ namespace BreCalClient.misc.Client
/// Temp folder path.
string TempFolderPath { get; }
///
- /// Gets the HTTP connection timeout (in milliseconds)
+ /// Gets the HTTP connection timeout.
///
/// HTTP connection timeout.
- int Timeout { get; }
+ TimeSpan Timeout { get; }
///
/// Gets the proxy.
///
@@ -7097,24 +7097,26 @@ namespace BreCalClient.misc.Model
public partial class Notification : IValidatableObject
{
///
- /// Gets or Sets NotificationType
+ /// Gets or Sets Type
///
- [DataMember(Name = "notification_type", EmitDefaultValue = true)]
- public NotificationType? NotificationType { get; set; }
+ [DataMember(Name = "type", EmitDefaultValue = true)]
+ public NotificationType? Type { get; set; }
///
/// Initializes a new instance of the class.
///
/// id.
/// shipcallId.
- /// notificationType.
+ /// participantId.
+ /// type.
/// message.
/// Readonly field set by the database when notification was created.
/// Readonly field set by the database when notification was last modified.
- public Notification(int id = default(int), int shipcallId = default(int), NotificationType? notificationType = default(NotificationType?), string message = default(string), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
+ public Notification(int id = default(int), int shipcallId = default(int), int? participantId = default(int?), NotificationType? type = default(NotificationType?), string message = default(string), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
{
this.Id = id;
this.ShipcallId = shipcallId;
- this.NotificationType = notificationType;
+ this.ParticipantId = participantId;
+ this.Type = type;
this.Message = message;
this.Created = created;
this.Modified = modified;
@@ -7136,6 +7138,14 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "shipcall_id", EmitDefaultValue = true)]
public int ShipcallId { get; set; }
///
+ /// Gets or Sets ParticipantId
+ ///
+ /*
+ 9
+ */
+ [DataMember(Name = "participant_id", EmitDefaultValue = true)]
+ public int? ParticipantId { get; set; }
+ ///
/// Gets or Sets Message
///
/*
@@ -7171,7 +7181,8 @@ namespace BreCalClient.misc.Model
sb.Append("class Notification {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" ShipcallId: ").Append(ShipcallId).Append("\n");
- sb.Append(" NotificationType: ").Append(NotificationType).Append("\n");
+ sb.Append(" ParticipantId: ").Append(ParticipantId).Append("\n");
+ sb.Append(" Type: ").Append(Type).Append("\n");
sb.Append(" Message: ").Append(Message).Append("\n");
sb.Append(" Created: ").Append(Created).Append("\n");
sb.Append(" Modified: ").Append(Modified).Append("\n");
diff --git a/misc/BreCalApi.yaml b/misc/BreCalApi.yaml
index a51bd29..da638ee 100644
--- a/misc/BreCalApi.yaml
+++ b/misc/BreCalApi.yaml
@@ -1550,7 +1550,11 @@ components:
type: integer
example: 5
nullable: false
- notification_type:
+ participant_id:
+ type: integer
+ example: 9
+ nullable: true
+ type:
$ref: '#/components/schemas/NotificationType'
message:
type: string
@@ -1569,7 +1573,8 @@ components:
example:
id: 42
shipcall_id: 5
- notification_type: next24h
+ participant_id: 9
+ type: next24h
message: Shipcall may be relevant to you in the next 24 hours
created: '2023-08-21T08:23:35Z'
modified: '2023-08-21T08:23:35Z'
@@ -1581,13 +1586,14 @@ components:
example:
- id: 42
shipcall_id: 5
- notification_type: time_conflict
+ participant_id: 9
+ type: time_conflict
message: Entry XY violates rule Z
created: '2023-08-21T08:23:35Z'
modified: '2023-08-21T08:23:35Z'
- id: 43
shipcall_id: 7
- notification_type: time_conflict
+ type: time_conflict
message: Entry AB violates rule C
created: '2023-08-21T08:23:35Z'
modified: '2023-08-21T08:23:35Z'
diff --git a/misc/version.txt b/misc/version.txt
index 1f0cf6b..c5e2be3 100644
--- a/misc/version.txt
+++ b/misc/version.txt
@@ -1 +1 @@
-1.7.0.0
\ No newline at end of file
+1.7.0.3
\ No newline at end of file
diff --git a/src/BreCalClient/AboutDialog.xaml b/src/BreCalClient/AboutDialog.xaml
index 06def3e..5e75673 100644
--- a/src/BreCalClient/AboutDialog.xaml
+++ b/src/BreCalClient/AboutDialog.xaml
@@ -30,6 +30,7 @@
+
@@ -47,7 +48,7 @@
Informatikbüro Daniel Schick
-
+
@@ -68,10 +69,10 @@
-
+
-
+
diff --git a/src/BreCalClient/App.config b/src/BreCalClient/App.config
index 335a433..31f6f0a 100644
--- a/src/BreCalClient/App.config
+++ b/src/BreCalClient/App.config
@@ -86,6 +86,12 @@
+
+ 0
+
+
+ 0
+
\ No newline at end of file
diff --git a/src/BreCalClient/App.xaml b/src/BreCalClient/App.xaml
index 9b54893..292becc 100644
--- a/src/BreCalClient/App.xaml
+++ b/src/BreCalClient/App.xaml
@@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BreCalClient"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
+ xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
StartupUri="MainWindow.xaml" Exit="Application_Exit" Startup="Application_Startup" >
@@ -14,6 +15,95 @@
10
10
+ #147ec9
+
+
+ #11ad45
+
+
+ #e60914
+
+
+ #f5a300
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BreCalClient/AppNotification.cs b/src/BreCalClient/AppNotification.cs
new file mode 100644
index 0000000..2dc95eb
--- /dev/null
+++ b/src/BreCalClient/AppNotification.cs
@@ -0,0 +1,181 @@
+// Copyright (c) 2024- schick Informatik
+// Description: Helper (static) class to handle polled API notifications
+//
+
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using ToastNotifications.Core;
+using BreCalClient.misc.Model;
+
+namespace BreCalClient
+{
+ internal class AppNotification
+ {
+ private static readonly Dictionary _notifications = new();
+ private readonly int _id;
+ private static readonly ObservableCollection _notificationsCollection = new();
+
+ public AppNotification(int id)
+ {
+ _id = id;
+ }
+
+ #region Properties
+
+ public int Id { get { return _id; } }
+
+ public string? NotificationType
+ {
+ get; private set;
+ }
+
+ public string? NotificationDisplay
+ {
+ get; private set;
+ }
+
+ public string? NotificationDate
+ {
+ get; private set;
+ }
+
+ public string? Ship
+ {
+ get; private set;
+ }
+
+ public string? ShipcallType
+ {
+ get; private set;
+ }
+
+ public string? Berth
+ {
+ get; private set;
+ }
+
+ public string? ETA
+ {
+ get; private set;
+ }
+
+ public string? Message
+ {
+ get; private set;
+ }
+
+
+ public static ObservableCollection AppNotifications { get { return _notificationsCollection; } }
+
+ #endregion
+
+ #region internal statics
+
+ internal static void LoadFromSettings()
+ {
+ _notifications.Clear();
+
+ // load notification ids that have been processed
+ foreach (string? notification_id in Properties.Settings.Default.Notifications)
+ {
+ if(Int32.TryParse(notification_id, out int result))
+ _notifications.Add(result, new AppNotification(result));
+ }
+ }
+
+ internal static void Clear()
+ {
+ _notifications.Clear();
+ SaveNotifications();
+ }
+
+ internal static bool UpdateNotifications(List notifications, System.Collections.Concurrent.ConcurrentDictionary currentShipcalls, ToastViewModel vm)
+ {
+ bool result = false;
+
+ foreach (BreCalClient.misc.Model.Notification notification in notifications)
+ {
+ if (notification.ParticipantId.HasValue && notification.ParticipantId.Value != App.Participant.Id) // not meant for us
+ continue;
+
+ if (!currentShipcalls.ContainsKey(notification.ShipcallId)) // not one of our shipcalls (maybe for another port or filtered)
+ continue;
+
+ if (!_notificationsCollection.Where(x => x.Id == notification.Id).Any())
+ {
+ List newList = new(_notificationsCollection);
+
+ AppNotification ap = new(notification.Id)
+ {
+ NotificationType = notification.Type.ToString(),
+ NotificationDate = notification.Created.ToString(),
+ Ship = currentShipcalls[notification.ShipcallId]?.Ship?.Name,
+ ShipcallType = currentShipcalls[notification.ShipcallId]?.Shipcall?.Type.ToString(),
+ ETA = currentShipcalls[notification.ShipcallId]?.GetETAETD(true)
+ };
+ Times? agencyTimes = currentShipcalls[notification.ShipcallId]?.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY);
+ ap.Berth = currentShipcalls[notification.ShipcallId]?.GetBerthText(agencyTimes);
+ ap.Message = notification.Message;
+
+ System.Diagnostics.Trace.WriteLine($"Notification {notification.Id} Type {notification.Type}");
+ MessageOptions options = new()
+ {
+ FontSize = 14,
+ ShowCloseButton = true,
+ Tag = ap
+ };
+
+ newList.Add(ap);
+ newList.Sort((a, b) => (a.NotificationDate ?? "").CompareTo(b.NotificationDate));
+ _notificationsCollection.Clear();
+ foreach(AppNotification newAp in newList)
+ _notificationsCollection.Add(newAp);
+
+ ap.NotificationDisplay = string.Empty;
+ switch(notification.Type)
+ {
+ case misc.Model.NotificationType.Assignment:
+ ap.NotificationDisplay = Resources.Resources.textAssignment; break;
+ case misc.Model.NotificationType.Next24h:
+ ap.NotificationDisplay = Resources.Resources.textNext24h; break;
+ case misc.Model.NotificationType.TimeConflict:
+ ap.NotificationDisplay = Resources.Resources.textTimeConflict; break;
+ case misc.Model.NotificationType.TimeConflictResolved:
+ ap.NotificationDisplay = Resources.Resources.textTimeConflictResolved; break;
+ case misc.Model.NotificationType.Unassigned:
+ ap.NotificationDisplay = Resources.Resources.textUnassigned; break;
+ }
+
+ string toastText = ap.NotificationDisplay + "\n";
+
+ toastText += $"{ap.Ship} ({ap.ShipcallType}) - {ap.ETA} - {ap.Berth}";
+ if (!string.IsNullOrEmpty(ap.Message))
+ toastText += $" \n{ap.Message}";
+
+ if (!_notifications.ContainsKey(notification.Id))
+ {
+ _notifications.Add(notification.Id, ap);
+ App.Current.Dispatcher.Invoke(() =>
+ {
+ vm.ShowAppNotification(toastText, options);
+ });
+ }
+ }
+ }
+ return result;
+ }
+
+ internal static void SaveNotifications()
+ {
+ Properties.Settings.Default.Notifications.Clear();
+ foreach (int notification_id in _notifications.Keys)
+ {
+ Properties.Settings.Default.Notifications.Add(notification_id.ToString());
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/src/BreCalClient/AppNotificationExtension.cs b/src/BreCalClient/AppNotificationExtension.cs
new file mode 100644
index 0000000..927c67e
--- /dev/null
+++ b/src/BreCalClient/AppNotificationExtension.cs
@@ -0,0 +1,23 @@
+// Copyright (c) 2024- schick Informatik
+// Description:
+//
+
+using ToastNotifications;
+using ToastNotifications.Core;
+
+namespace BreCalClient
+{
+ public static class AppNotificationExtension
+ {
+ public static void ShowAppNotification(this Notifier notifier, string message)
+ {
+ notifier.Notify(() => new AppNotificationMessage(message));
+ }
+
+ public static void ShowAppNotification(this Notifier notifier, string message, MessageOptions displayOptions)
+ {
+ notifier.Notify(() => new AppNotificationMessage(message, displayOptions));
+ }
+
+ }
+}
diff --git a/src/BreCalClient/AppNotificationMessage.cs b/src/BreCalClient/AppNotificationMessage.cs
new file mode 100644
index 0000000..2a0e194
--- /dev/null
+++ b/src/BreCalClient/AppNotificationMessage.cs
@@ -0,0 +1,30 @@
+using System.Windows;
+using ToastNotifications.Core;
+using ToastNotifications.Messages.Core;
+
+namespace BreCalClient
+{
+ public class AppNotificationMessage : MessageBase
+ {
+ public AppNotificationMessage(string message) : this(message, new MessageOptions())
+ {
+ }
+
+ public AppNotificationMessage(string message, MessageOptions options) : base(message, options)
+ {
+ }
+
+ protected override AppNotificationPart CreateDisplayPart()
+ {
+ return new AppNotificationPart(this);
+ }
+
+ protected override void UpdateDisplayOptions(AppNotificationPart displayPart, MessageOptions options)
+ {
+ // if (options.FontSize != null)
+ // displayPart.Text.FontSize = options.FontSize.Value;
+
+ // displayPart.CloseButton.Visibility = options.ShowCloseButton ? Visibility.Visible : Visibility.Collapsed;
+ }
+ }
+}
diff --git a/src/BreCalClient/AppNotificationPart.xaml b/src/BreCalClient/AppNotificationPart.xaml
new file mode 100644
index 0000000..50b33c5
--- /dev/null
+++ b/src/BreCalClient/AppNotificationPart.xaml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BreCalClient/AppNotificationPart.xaml.cs b/src/BreCalClient/AppNotificationPart.xaml.cs
new file mode 100644
index 0000000..b717fd7
--- /dev/null
+++ b/src/BreCalClient/AppNotificationPart.xaml.cs
@@ -0,0 +1,51 @@
+using BreCalClient.misc.Model;
+using System.Windows;
+using System.Windows.Media;
+using ToastNotifications.Core;
+
+namespace BreCalClient
+{
+ ///
+ /// Interaction logic for NotificationPart.xaml
+ ///
+ public partial class AppNotificationPart : NotificationDisplayPart
+ {
+ public AppNotificationPart(AppNotificationMessage appNotification)
+ {
+ InitializeComponent();
+ Bind(appNotification);
+
+ if (appNotification.Options.Tag is AppNotification ap)
+ {
+ switch (ap.NotificationType)
+ {
+ case "TimeConflict":
+ this.ContentWrapper.Background = Brushes.Red;
+ break;
+ case "TimeConflictResolved":
+ this.ContentWrapper.Background = Brushes.Green;
+ break;
+ case "Assignment":
+ this.ContentWrapper.Background = Brushes.Blue;
+ break;
+ case "Next24h":
+ this.ContentWrapper.Background = Brushes.DarkOrange;
+ break;
+ case "Unassigned":
+ this.ContentWrapper.Background = Brushes.Gray;
+ break;
+ default:
+ break;
+
+ }
+ }
+
+ }
+
+ private void OnClose(object sender, RoutedEventArgs e)
+ {
+ Notification.Close();
+ }
+
+ }
+}
diff --git a/src/BreCalClient/BreCalClient.csproj b/src/BreCalClient/BreCalClient.csproj
index 1493944..22cc7e2 100644
--- a/src/BreCalClient/BreCalClient.csproj
+++ b/src/BreCalClient/BreCalClient.csproj
@@ -8,8 +8,8 @@
True
BreCalClient.App
..\..\misc\brecal.snk
- 1.7.0.0
- 1.7.0.0
+ 1.7.0.3
+ 1.7.0.3
Bremen calling client
A Windows WPF client for the Bremen calling API.
containership.ico
@@ -26,6 +26,7 @@
+
@@ -84,6 +85,7 @@
+
@@ -118,10 +120,12 @@
-
+
-
-
+
+
+
+
diff --git a/src/BreCalClient/HistoryDialog.xaml.cs b/src/BreCalClient/HistoryDialog.xaml.cs
index ce6cb2b..f827de0 100644
--- a/src/BreCalClient/HistoryDialog.xaml.cs
+++ b/src/BreCalClient/HistoryDialog.xaml.cs
@@ -1,5 +1,5 @@
// Copyright (c) 2024- schick Informatik
-// Description: Window to show (complete) list of current shipcall histories
+// Description:
//
using BreCalClient.misc.Api;
diff --git a/src/BreCalClient/MainWindow.xaml b/src/BreCalClient/MainWindow.xaml
index dd169f8..f7f14eb 100644
--- a/src/BreCalClient/MainWindow.xaml
+++ b/src/BreCalClient/MainWindow.xaml
@@ -124,6 +124,8 @@
+
+
@@ -157,19 +159,25 @@
+
+
+
+
-
-
+
+
-
+
-
-
+
+
diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs
index cb0056b..be19337 100644
--- a/src/BreCalClient/MainWindow.xaml.cs
+++ b/src/BreCalClient/MainWindow.xaml.cs
@@ -36,8 +36,11 @@ namespace BreCalClient
public partial class MainWindow : Window
{
private readonly ILog _log = LogManager.GetLogger(typeof(MainWindow));
+ private readonly ToastViewModel _vm;
+
private const int SHIPCALL_UPDATE_INTERVAL_SECONDS = 30;
private const int SHIPS_UPDATE_INTERVAL_SECONDS = 120;
+ private const int CHECK_NOTIFICATIONS_INTERVAL_SECONDS = 5;
private const int PROGRESS_STEPS = 50;
#region Fields
@@ -68,6 +71,7 @@ namespace BreCalClient
// private bool _filterChanged = false;
// private bool _sequenceChanged = false;
private HistoryDialog? _historyDialog;
+ private NotificationDialog? _notificationDialog;
#endregion
@@ -122,6 +126,13 @@ namespace BreCalClient
RetryConfiguration.AsyncRetryPolicy = retryPolicy;
this.generalProgressStatus.Maximum = PROGRESS_STEPS;
+ _vm = new ToastViewModel();
+ this.Unloaded += MainWindow_Unloaded;
+ }
+
+ private void MainWindow_Unloaded(object sender, RoutedEventArgs e)
+ {
+ _vm.OnUnloaded();
}
#endregion
@@ -443,6 +454,21 @@ namespace BreCalClient
}
}
+ private void buttonNotifications_Click(object sender, RoutedEventArgs e)
+ {
+ if (_notificationDialog == null)
+ {
+ _notificationDialog = new NotificationDialog();
+ _notificationDialog.AppNotifications = AppNotification.AppNotifications;
+ _notificationDialog.Closed += (sender, e) => { this._notificationDialog = null; };
+ _notificationDialog.Show();
+ }
+ else
+ {
+ _notificationDialog.Activate();
+ }
+ }
+
private void buttonManualRefresh_Click(object sender, RoutedEventArgs e)
{
_refreshImmediately = true; // set flag to avoid timer loop termination
@@ -510,6 +536,7 @@ namespace BreCalClient
_ = Task.Run(() => RefreshShipcalls());
_ = Task.Run(() => RefreshShips());
+ _ = Task.Run(() => CheckNotifications());
}
@@ -633,6 +660,19 @@ namespace BreCalClient
}
}
+ public async Task CheckNotifications()
+ {
+ while (true)
+ {
+ Thread.Sleep(CHECK_NOTIFICATIONS_INTERVAL_SECONDS * 1000);
+ if (_loginResult?.NotifyPopup ?? false)
+ {
+ List notifications = await _staticApi.NotificationsGetAsync();
+ AppNotification.UpdateNotifications(notifications, _allShipcallsDict, _vm);
+ }
+ }
+ }
+
#endregion
#region basic operations
diff --git a/src/BreCalClient/NotificationDialog.xaml b/src/BreCalClient/NotificationDialog.xaml
new file mode 100644
index 0000000..6fab214
--- /dev/null
+++ b/src/BreCalClient/NotificationDialog.xaml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BreCalClient/NotificationDialog.xaml.cs b/src/BreCalClient/NotificationDialog.xaml.cs
new file mode 100644
index 0000000..f2d7871
--- /dev/null
+++ b/src/BreCalClient/NotificationDialog.xaml.cs
@@ -0,0 +1,44 @@
+// Copyright (c) 2024- schick Informatik
+// Description:
+//
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+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 NotificationDialog.xaml
+ ///
+ public partial class NotificationDialog : Window
+ {
+ public NotificationDialog()
+ {
+ InitializeComponent();
+ }
+
+ internal ObservableCollection? AppNotifications { get; set; }
+
+ private void buttonClose_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+
+ private void Window_Loaded(object sender, RoutedEventArgs e)
+ {
+ this.dataGridNotifications.ItemsSource = AppNotifications;
+ }
+ }
+}
diff --git a/src/BreCalClient/Properties/PublishProfiles/ClickOnceDevelProfile.pubxml b/src/BreCalClient/Properties/PublishProfiles/ClickOnceDevelProfile.pubxml
index 3747c9b..4a73b96 100644
--- a/src/BreCalClient/Properties/PublishProfiles/ClickOnceDevelProfile.pubxml
+++ b/src/BreCalClient/Properties/PublishProfiles/ClickOnceDevelProfile.pubxml
@@ -4,8 +4,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
- 2
- 1.7.0.0
+ 1
+ 1.7.0.3
True
Debug
True
@@ -38,7 +38,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
Foreground
True
Publish.html
- 1.7.0.0
+ 1.7.0.3
false
diff --git a/src/BreCalClient/Properties/Settings.Designer.cs b/src/BreCalClient/Properties/Settings.Designer.cs
index ece7fc6..c5b234b 100644
--- a/src/BreCalClient/Properties/Settings.Designer.cs
+++ b/src/BreCalClient/Properties/Settings.Designer.cs
@@ -9,20 +9,20 @@
//------------------------------------------------------------------------------
namespace BreCalClient.Properties {
-
-
+
+
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-
+
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
+
public static Settings Default {
get {
return defaultInstance;
}
}
-
+
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#1D751F")]
@@ -31,7 +31,7 @@ namespace BreCalClient.Properties {
return ((string)(this["BG_COLOR"]));
}
}
-
+
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("!!Bremen calling Testversion!!")]
@@ -40,7 +40,7 @@ namespace BreCalClient.Properties {
return ((string)(this["APP_TITLE"]));
}
}
-
+
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("https://www.textbausteine.net/")]
@@ -49,7 +49,7 @@ namespace BreCalClient.Properties {
return ((string)(this["LOGO_IMAGE_URL"]));
}
}
-
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
@@ -61,7 +61,7 @@ namespace BreCalClient.Properties {
this["FilterCriteria"] = value;
}
}
-
+
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("https://brecaldevel.bsmd-emswe.eu")]
@@ -70,7 +70,7 @@ namespace BreCalClient.Properties {
return ((string)(this["API_URL"]));
}
}
-
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("800")]
@@ -82,7 +82,7 @@ namespace BreCalClient.Properties {
this["Width"] = value;
}
}
-
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("450")]
@@ -94,7 +94,7 @@ namespace BreCalClient.Properties {
this["Height"] = value;
}
}
-
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
@@ -106,7 +106,7 @@ namespace BreCalClient.Properties {
this["Left"] = value;
}
}
-
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
@@ -118,7 +118,7 @@ namespace BreCalClient.Properties {
this["Top"] = value;
}
}
-
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
@@ -130,7 +130,7 @@ namespace BreCalClient.Properties {
this["W1Left"] = value;
}
}
-
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
@@ -142,7 +142,7 @@ namespace BreCalClient.Properties {
this["W1Top"] = value;
}
}
-
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
@@ -154,7 +154,7 @@ namespace BreCalClient.Properties {
this["W2Left"] = value;
}
}
-
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
@@ -166,7 +166,7 @@ namespace BreCalClient.Properties {
this["W2Top"] = value;
}
}
-
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
@@ -178,7 +178,7 @@ namespace BreCalClient.Properties {
this["W3Left"] = value;
}
}
-
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
@@ -190,7 +190,7 @@ namespace BreCalClient.Properties {
this["W3Top"] = value;
}
}
-
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
@@ -202,7 +202,7 @@ namespace BreCalClient.Properties {
this["W4Left"] = value;
}
}
-
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
@@ -214,7 +214,7 @@ namespace BreCalClient.Properties {
this["W4Top"] = value;
}
}
-
+
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
@@ -226,5 +226,40 @@ namespace BreCalClient.Properties {
this["FilterCriteriaMap"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public global::System.Collections.Specialized.StringCollection Notifications {
+ get {
+ return ((global::System.Collections.Specialized.StringCollection)(this["Notifications"]));
+ }
+ set {
+ this["Notifications"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("0")]
+ public double W5Top {
+ get {
+ return ((double)(this["W5Top"]));
+ }
+ set {
+ this["W5Top"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("0")]
+ public double W5Left {
+ get {
+ return ((double)(this["W5Left"]));
+ }
+ set {
+ this["W5Left"] = value;
+ }
+ }
}
}
diff --git a/src/BreCalClient/Properties/Settings.settings b/src/BreCalClient/Properties/Settings.settings
index b10fd5b..e7203cb 100644
--- a/src/BreCalClient/Properties/Settings.settings
+++ b/src/BreCalClient/Properties/Settings.settings
@@ -56,5 +56,14 @@
+
+
+
+
+ 0
+
+
+ 0
+
\ No newline at end of file
diff --git a/src/BreCalClient/Resources/Resources.Designer.cs b/src/BreCalClient/Resources/Resources.Designer.cs
index 334beb7..f04dd86 100644
--- a/src/BreCalClient/Resources/Resources.Designer.cs
+++ b/src/BreCalClient/Resources/Resources.Designer.cs
@@ -167,6 +167,16 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized resource of type System.Byte[].
+ ///
+ public static byte[] bell3 {
+ get {
+ object obj = ResourceManager.GetObject("bell3", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Byte[].
///
@@ -380,6 +390,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Participant assigned to shipcall.
+ ///
+ public static string textAssignment {
+ get {
+ return ResourceManager.GetString("textAssignment", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Berth.
///
@@ -560,6 +579,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Date.
+ ///
+ public static string textDate {
+ get {
+ return ResourceManager.GetString("textDate", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Delete.
///
@@ -884,6 +912,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Relevant next 24hrs.
+ ///
+ public static string textNext24h {
+ get {
+ return ResourceManager.GetString("textNext24h", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Notifications.
///
@@ -1208,6 +1245,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Shipcall.
+ ///
+ public static string textShipcall {
+ get {
+ return ResourceManager.GetString("textShipcall", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Ship length.
///
@@ -1244,6 +1290,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Show notificiations.
+ ///
+ public static string textShowNotifications {
+ get {
+ return ResourceManager.GetString("textShowNotifications", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Sort order.
///
@@ -1307,6 +1362,24 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Participants disagree on times.
+ ///
+ public static string textTimeConflict {
+ get {
+ return ResourceManager.GetString("textTimeConflict", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Times conflict resolved.
+ ///
+ public static string textTimeConflictResolved {
+ get {
+ return ResourceManager.GetString("textTimeConflictResolved", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Timestamp.
///
@@ -1397,6 +1470,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Participant unassigned from shipcall.
+ ///
+ public static string textUnassigned {
+ get {
+ return ResourceManager.GetString("textUnassigned", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to User login.
///
diff --git a/src/BreCalClient/Resources/Resources.de.resx b/src/BreCalClient/Resources/Resources.de.resx
index 183f264..905ed32 100644
--- a/src/BreCalClient/Resources/Resources.de.resx
+++ b/src/BreCalClient/Resources/Resources.de.resx
@@ -565,4 +565,28 @@
Banner / Push Benachrichtigung in App
+
+ Datum
+
+
+ Anlauf
+
+
+ Benachrichtigungen anzeigen
+
+
+ Teilnehmer wurde nominiert
+
+
+ Relevant für Morgenrunde (24hrs)
+
+
+ "Ampel"-Regel(n) wurde verletzt
+
+
+ Zeitliche Konflikte aufgelöst
+
+
+ Nominierung des Teilnehmer entfernt
+
\ No newline at end of file
diff --git a/src/BreCalClient/Resources/Resources.resx b/src/BreCalClient/Resources/Resources.resx
index 5ea32f5..19533f0 100644
--- a/src/BreCalClient/Resources/Resources.resx
+++ b/src/BreCalClient/Resources/Resources.resx
@@ -613,4 +613,31 @@
Notify by push notification in app
+
+ bell3.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Participant assigned to shipcall
+
+
+ Date
+
+
+ Relevant next 24hrs
+
+
+ Shipcall
+
+
+ Show notificiations
+
+
+ Participants disagree on times
+
+
+ Times conflict resolved
+
+
+ Participant unassigned from shipcall
+
\ No newline at end of file
diff --git a/src/BreCalClient/Resources/bell3.png b/src/BreCalClient/Resources/bell3.png
new file mode 100644
index 0000000..ddc6a0e
Binary files /dev/null and b/src/BreCalClient/Resources/bell3.png differ
diff --git a/src/BreCalClient/ShipListDialog.xaml.cs b/src/BreCalClient/ShipListDialog.xaml.cs
index 7ad18ed..557faf8 100644
--- a/src/BreCalClient/ShipListDialog.xaml.cs
+++ b/src/BreCalClient/ShipListDialog.xaml.cs
@@ -98,7 +98,7 @@ namespace BreCalClient
private async void DataGridShips_CreateRequested()
{
- ShipModel shipModel = new((ShipModel.LastEditShip != null) ? ShipModel.LastEditShip : new Ship());
+ ShipModel shipModel = new(ShipModel.LastEditShip ?? new Ship());
EditShipDialog esd = new()
{
diff --git a/src/BreCalClient/ToastViewModel.cs b/src/BreCalClient/ToastViewModel.cs
new file mode 100644
index 0000000..3978efe
--- /dev/null
+++ b/src/BreCalClient/ToastViewModel.cs
@@ -0,0 +1,73 @@
+// Copyright (c) 2024- schick Informatik
+// Description:
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows;
+
+using ToastNotifications;
+using ToastNotifications.Core;
+using ToastNotifications.Lifetime;
+using ToastNotifications.Lifetime.Clear;
+using ToastNotifications.Messages;
+using ToastNotifications.Position;
+
+namespace BreCalClient
+{
+ internal class ToastViewModel : INotifyPropertyChanged
+ {
+ private readonly Notifier _notifier;
+
+ public ToastViewModel()
+ {
+ _notifier = new Notifier(cfg =>
+ {
+ cfg.PositionProvider = new WindowPositionProvider(
+ parentWindow: Application.Current.MainWindow,
+ corner: Corner.BottomRight,
+ offsetX: 25,
+ offsetY: 100);
+
+ cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
+ notificationLifetime: TimeSpan.FromSeconds(30),
+ maximumNotificationCount: MaximumNotificationCount.FromCount(6));
+
+ cfg.Dispatcher = Application.Current.Dispatcher;
+
+ cfg.DisplayOptions.TopMost = false;
+ cfg.DisplayOptions.Width = 250;
+ });
+
+ _notifier.ClearMessages(new ClearAll());
+ }
+
+ public void OnUnloaded()
+ {
+ _notifier.Dispose();
+ }
+
+ public void ShowAppNotification(string message, MessageOptions options)
+ {
+ _notifier?.ShowAppNotification(message, options);
+ }
+
+ public void ShowAppNotification(string message)
+ {
+ _notifier?.ShowAppNotification(message);
+ }
+
+ public event PropertyChangedEventHandler? PropertyChanged;
+
+ protected virtual void OnPropertyChanged(string? propertyName = null)
+ {
+ var handler = PropertyChanged;
+ handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ public void ClearAll()
+ {
+ _notifier.ClearMessages(new ClearAll());
+ }
+ }
+}
diff --git a/src/RoleEditor/RoleEditor.csproj b/src/RoleEditor/RoleEditor.csproj
index abda60e..f7cea9b 100644
--- a/src/RoleEditor/RoleEditor.csproj
+++ b/src/RoleEditor/RoleEditor.csproj
@@ -6,8 +6,8 @@
enable
true
Resources\lock_preferences.ico
- 1.7.0.0
- 1.7.0.0
+ 1.7.0.3
+ 1.7.0.3