Beispiel #1
0
 public void Display(INotification notification)
 {
     if (notification is Amusoft.UI.WPF.Notifications.INotification uiNotification)
     {
         var manager = GetManager(notification);
         manager.DisplayAsync(uiNotification, TranslatePosition(notification.Position));
     }
     else
     {
         throw new Exception($"Notification type is not supported because it does not implement Amusoft.UI.WPF.Notifications.INotification.");
     }
 }
Beispiel #2
0
        private NotificationHost GetManager(INotification uiNotification)
        {
            switch (uiNotification.Target)
            {
            case NotificationTarget.PrimaryScreen:
                return(NotificationHostManager.GetHostByScreen(Screen.PrimaryScreen));

            case NotificationTarget.CurrentFocusedWindow:
                return(NotificationHostManager.GetHostByVisual(GetCurrentFocusedWindow()));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }