Interaction logic for OverlayToast.xaml
Inheritance: System.Windows.Controls.UserControl
Exemplo n.º 1
0
 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)
         {
         }
     }
Exemplo n.º 2
0
        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}");
                }
        }