public void Remove(MenuNotificationViewModel notificationVm) { if (notificationVm == null) { throw new ArgumentNullException(nameof(notificationVm)); } notifications.Remove(notificationVm); repository.Remove(notificationVm.MenuNotification); NotificationCollectionChanged?.Invoke(this, new NotificationCollectionChangedEventArgs(NotificationCollectionChangedAction.Remove, notificationVm.MenuNotification)); }
public void Add(MenuNotification notification) { if (notification == null) { throw new ArgumentNullException(nameof(notification)); } MenuNotificationViewModel notificationVm = new MenuNotificationViewModel(notification); notificationVm.RequestClose += (s, e) => Remove(s as MenuNotificationViewModel); notifications.Add(notificationVm); //Program.MainWindow.Invoke(() => //{ // notifications.Add(notificationVm); //}); //notification.IsDirty = true; NotificationCollectionChanged?.Invoke(this, new NotificationCollectionChangedEventArgs(NotificationCollectionChangedAction.Add, notification)); }
private void _Remove(MenuNotificationViewModel notification) { notifications.Remove(notification); repository.Remove(notification.MenuNotification); }