public void PopupNotification(OverlayNotification notification) { if (Settings.Default.EnableOverlay) { try { Dispatcher.Invoke(() => { if (notification.UniqueID != null && StackNotifications.GetChildObjects() .Any( toast => (toast as OverlayToast)?.BaseNotification.UniqueID == notification.UniqueID)) { return; } var popupNotification = new OverlayToast(notification); popupNotification.NotificationCompleted += (sender, args) => { StackNotifications.Children.Remove(popupNotification); popupNotification = null; }; StackNotifications.Children.Add(popupNotification); }); } catch (ThreadAbortException) { } }
public void PopupNotification(OverlayNotification notification) { if (Settings.Default.EnableOverlay) try { Dispatcher.Invoke(() => { if (notification.UniqueID != null && StackNotifications.GetChildObjects() .Any( toast => (toast as OverlayToast)?.BaseNotification.UniqueID == notification.UniqueID)) return; var popupNotification = new OverlayToast(notification); popupNotification.NotificationCompleted += (sender, args) => { StackNotifications.Children.Remove(popupNotification); popupNotification = null; }; StackNotifications.Children.Add(popupNotification); }); } catch (ThreadAbortException) { } catch (Exception ex) { Log.WriteLine($"Exception occured during popup creation: {ex.Message}"); } }