public FindResult ChangeDocument(SrmDocument document) { var result = new FindResult(this) { Document = document }; var bookMarkEnumerator = BookmarkEnumerator.TryGet(document, Bookmark); FindMatch findMatch = null; if (bookMarkEnumerator != null) { findMatch = FindPredicate.Match(bookMarkEnumerator); } if (findMatch == null) { result.IsValid = false; } else { result.IsValid = true; result.FindMatch = findMatch; } return(result); }
public void HighlightFindResult(FindResult findResult) { if (!IsComplete) { _pendingFindResult = findResult; return; } var bookmarkEnumerator = BookmarkEnumerator.TryGet(_dataSchema.Document, findResult.Bookmark); if (bookmarkEnumerator == null) { return; } var chromInfo = bookmarkEnumerator.CurrentChromInfo; if (chromInfo == null) { return; } int?iRowMatch = null; for (int iRow = 0; iRow < BindingListSource.Count; iRow++) { var rowItem = BindingListSource[iRow] as RowItem; if (rowItem == null) { continue; } var replicate = rowItem.Value as Replicate; if (replicate != null) { if (replicate.Files.Any(file => ReferenceEquals(file.ChromFileInfoId, chromInfo.FileId))) { iRowMatch = iRow; break; } } var result = rowItem.Value as Result; if (null != result) { if (ReferenceEquals(result.GetResultFile().ChromFileInfoId, chromInfo.FileId)) { iRowMatch = iRow; break; } } } if (!iRowMatch.HasValue) { return; } BindingListSource.Position = iRowMatch.Value; DataGridViewColumn column; if (findResult.FindMatch.Note) { column = FindColumn(PropertyPath.Root.Property("Note")); // Not L10N } else if (findResult.FindMatch.AnnotationName != null) { column = FindColumn(PropertyPath.Root.Property( AnnotationDef.ANNOTATION_PREFIX + findResult.FindMatch.AnnotationName)); } else { return; } if (null != column && null != DataGridView.CurrentRow) { DataGridView.CurrentCell = DataGridView.CurrentRow.Cells[column.Index]; } }