private void RemoveSelectedTusToAnonymize() { foreach (var searchResult in SourceSearchResults.Where(s => s.TuSelected).ToList()) { SourceSearchResults.Remove(searchResult); } }
private void _tmsCollection_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Remove) { if (e.OldItems == null) { return; } foreach (TmFile removedTm in e.OldItems) { var tusForRemovedTm = SourceSearchResults.Where(t => t.TmFilePath.Equals(removedTm.Path)).ToList(); foreach (var tu in tusForRemovedTm) { SourceSearchResults.Remove(tu); } } } }
private void _translationMemoryViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName.Equals("TmsCollection")) { //removed from tm collection var unselectedTms = _tmsCollection.Where(t => !t.IsSelected).ToList(); foreach (var tm in unselectedTms) { var anonymizedTmToRemove = _anonymizeTranslationMemories.FirstOrDefault(t => t.TmPath.Equals(tm.Path)); if (anonymizedTmToRemove != null) { _anonymizeTranslationMemories.Remove(anonymizedTmToRemove); } //remove search results for that tm var searchResultsForTm = SourceSearchResults.Where(r => r.TmFilePath.Equals(tm.Path)).ToList(); foreach (var result in searchResultsForTm) { SourceSearchResults.Remove(result); } } } }