From 873c437d98576b593550b31623245994bf6fe534 Mon Sep 17 00:00:00 2001 From: dimedtec Date: Wed, 7 Oct 2026 16:51:46 +0200 Subject: [PATCH] Popup auffaellig, bleibt waehrend Klingeln offen, Tray-Icon blinkt bis Anrufliste geoeffnet --- src/Anrufmonitor.App/App.xaml.cs | 19 ++++++- src/Anrufmonitor.App/CallPopupWindow.xaml | 54 +++++++++++--------- src/Anrufmonitor.App/CallPopupWindow.xaml.cs | 30 +++++++---- src/Anrufmonitor.App/TrayIconFactory.cs | 6 ++- src/Anrufmonitor.App/TrayIconManager.cs | 43 ++++++++++++++-- src/Anrufmonitor.App/appsettings.json | 3 ++ 6 files changed, 115 insertions(+), 40 deletions(-) diff --git a/src/Anrufmonitor.App/App.xaml.cs b/src/Anrufmonitor.App/App.xaml.cs index 9b1b80b..90c3f53 100644 --- a/src/Anrufmonitor.App/App.xaml.cs +++ b/src/Anrufmonitor.App/App.xaml.cs @@ -79,13 +79,20 @@ public partial class App : System.Windows.Application var logger = _host.Services.GetRequiredService>(); var cache = _host.Services.GetRequiredService(); + CallPopupWindow.Corner = _host.Services.GetRequiredService()["Popup:Corner"] ?? "BottomRight"; + var endedCallIds = new HashSet(); + _trayIconManager = new TrayIconManager( onSyncNow: async () => { var syncService = _host.Services.GetRequiredService(); await syncService.SyncOnceAsync(CancellationToken.None); }, - onShowHistory: () => CallHistoryWindow.ShowAsync(cache), + onShowHistory: () => + { + _trayIconManager?.StopAttention(); + return CallHistoryWindow.ShowAsync(cache); + }, onExit: () => System.Windows.Application.Current.Shutdown()); _trayIconManager.Show(); @@ -112,6 +119,12 @@ public partial class App : System.Windows.Application System.Windows.Application.Current.Dispatcher.Invoke(() => { + // Anruf war schon beendet, bevor der Kontakt aufgeloest war: kein Popup mehr noetig + if (endedCallIds.Remove(args.CallId)) + { + return; + } + var popup = new CallPopupWindow(contact, args.CallId, args.CalledNumber); popup.Show(); }); @@ -127,6 +140,10 @@ public partial class App : System.Windows.Application System.Windows.Application.Current.Dispatcher.Invoke(() => { CallPopupWindow.CloseByCallId(args.CallId); + endedCallIds.Add(args.CallId); + + // Klingeln beendet: Tray-Icon blinkt, bis die Anrufliste geoeffnet wird. + _trayIconManager?.StartAttention(); }); }; diff --git a/src/Anrufmonitor.App/CallPopupWindow.xaml b/src/Anrufmonitor.App/CallPopupWindow.xaml index 329427d..67e6c4c 100644 --- a/src/Anrufmonitor.App/CallPopupWindow.xaml +++ b/src/Anrufmonitor.App/CallPopupWindow.xaml @@ -1,40 +1,46 @@ - - - - - - - - - + + + + + + + + + + + + - + - + - - - - + + + + - + -