/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ protected override bool Verify() { // Commit pending changes in the grid. m_grid.CommitEdit(DataGridViewDataErrorContexts.Commit); foreach (ListViewItem item in lvFilters.Items) { PaFilter filter = item.Tag as PaFilter; if (filter != null) { foreach (FilterExpression expression in filter.Expressions) { // Make sure expressions based on phonetic search patterns are valid. if (expression.ExpressionType == ExpressionType.PhoneticSrchPtrn && FilterHelper.CheckSearchQuery(expression.SearchQuery, true) == null) { lvFilters.SelectedItems.Clear(); lvFilters.FocusedItem = item; item.Selected = true; m_grid.Focus(); return(false); } } } } return(true); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public bool Matches(WordCacheEntry entry) { bool match = false; foreach (FilterExpression expression in m_expressions) { if (expression.ExpressionType == ExpressionType.PhoneticSrchPtrn && expression.SearchEngine == null) { expression.SearchEngine = FilterHelper.CheckSearchQuery(expression.SearchQuery, false); if (expression.SearchEngine == null) { return(false); } } match = expression.Matches(entry); // If the entry matches and we're logically OR'ing the expressions, // then we're done here. The entry matches the filter. if (match && m_fOrExpressions) { return(true); } // If the entry didn't match and the expressions are logically AND'd, // then we're done here. The entry doesn't match the filter. if (!match && !m_fOrExpressions) { return(false); } } return(match); }