private void OpenNotificationWindow(object obj) { bool isWindowOpen = false; foreach (Window w in Application.Current.Windows) { if (w is NotificationWindow) { isWindowOpen = true; w.Activate(); } } if (!isWindowOpen) { NotificationWindow newwindow = new NotificationWindow(); newwindow.Show(); } }
private void DisplayNotification(object sender, EventArgs e) { bool isWindowOpen = false; foreach (Window w in Application.Current.Windows) { if (w is NotificationWindow || w is NotificationPreviewWindow) { isWindowOpen = true; } } if (!isWindowOpen) { if (NotificationQueue.Count != 0) { Notification n = NotificationQueue.First(); NotificationQueue.Remove(n); NotificationWindow newWindow = new NotificationWindow(); (newWindow.DataContext as NotificationWindowViewModel).Notification = n.NotificationString; newWindow.Show(); } } }