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 @@ - - - - - - - - - + + + + + + + + + + + + - + - + - - - - + + + + - + -