public void RemoveNotification(NotificationBase notification) { if (!Dispatcher.CheckAccess()) { Dispatcher.Invoke(new Action(() => RemoveNotification(notification))); return; } if (Notifications.Contains(notification)) { Notifications.Remove(notification); } if (buffer.Count > 0) { Notifications.Add(buffer[0]); buffer.RemoveAt(0); } //Close window if there's nothing to show Resize(); }
public void AddNotification(NotificationBase notification) { if (!Dispatcher.CheckAccess()) { Dispatcher.Invoke(new Action(() => AddNotification(notification))); return; } notification.Id = count++; if (Notifications.Count + 1 > MAX_NOTIFICATIONS) { buffer.Add(notification); } else { Notifications.Add(notification); } //Show window if there're notifications if (Notifications.Count > 0 && !IsActive) { Show(); } Resize(); }