public void Remove(DocumentFilterEntryViewModel entryViewModel) { if (entryViewModel == null) { throw new ArgumentNullException(nameof(entryViewModel)); } this.AdjustFilterEntries(entryViewModel, (entries, e) => entries.Remove(e)); this.ApplyCurrentFilters(); }
private static bool Exists(DocumentFilterViewModel filterViewModel, DocumentFilterEntryViewModel searchEntryViewModel) { foreach (var entryViewModel in filterViewModel.Entries) { if (entryViewModel == searchEntryViewModel) { return(true); } } return(false); }
private void AdjustFilterEntries(DocumentFilterEntryViewModel entryViewModel, Action <ObservableCollection <DocumentFilterEntryViewModel>, DocumentFilterEntryViewModel> operation) { foreach (var filterViewModel in this.Filters) { var exists = Exists(filterViewModel, entryViewModel); if (exists) { operation(filterViewModel.SelectedEntries, entryViewModel); break; } } }