/// <summary> /// Removes a notification from the queue. /// </summary> /// <param name="toastNotification">The <see cref="ToastNotificationBase"/> to remove.</param> public void Dequeue(ToastNotificationBase toastNotification) { if (CurrentNotification == toastNotification) { toastNotification.CompleteToast(DismissStatus.InternalDismissed); } lock (_notificationQueueLock) { _notificationsQueue.Remove(toastNotification); } }
private void InternalReplaceQueueItem(ToastNotificationBase toastNotification) { lock (_notificationQueueLock) { ToastNotificationBase actualNotification = _notificationsQueue.FirstOrDefault(notification => notification.Id == toastNotification.Id && notification.Id != null); if (actualNotification == null) { throw new ArgumentNullException("actualNotification"); } actualNotification.CompleteToast(dismissStatus: DismissStatus.InternalDismissed); int actualNotificationIndex = _notificationsQueue.IndexOf(actualNotification); _notificationsQueue.Remove(actualNotification); _notificationsQueue.Insert(actualNotificationIndex, toastNotification); } }