private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { // var manager = NotificationHostManager.GetHostByScreen(Screen.PrimaryScreen); var manager = NotificationHostManager.GetHostByVisual(this); foreach (Position position in Enum.GetValues(typeof(Position))) { var notification = new SimpleNotification($"Test notification {position}."); manager.DisplayAsync(notification, position); } }
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(); } }