private async void ClosedCommandExecute(string id) { //this method is removing notifications from the list Debug.WriteLine($"NotificationListViewModel.ClosedCommandExecute() with ID = {id}"); if (_notificationCollection.Where(x => x.ID == id).Count() > 0) { Debug.WriteLine($"Removing item with id = {id}"); await _DispatcherHelper.RunAsync(() => { var notification = _notificationCollection.FirstOrDefault(x => x.ID == id); NotificationCollection.Remove(notification); //TODO dispose notification - notification.Dispose(); }); } }
public void RemoveNotification(Notification notification) { 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 if (Notifications.Count < 1) { Hide(); } }