private void DoResetSearch() { if (m_currentQueryInfo != null) { m_currentQueryInfo.Cancel(); m_currentQueryInfo = null; } if (!m_fResetSearchInProgress) { return; // last reset succeeded, nothing to do. } m_fResetSearchAborted = false; ClearResetTimer(); if (ShouldAbort()) { return; } m_currentQueryInfo = new ExtantEntryInfo(); m_currentQueryInfo.ExtantEntriesCompleted += new EventHandler(m_currentQueryInfo_ExtantEntriesCompleted); // This should come before we call StartGetting...because the Completed call // can happen DURING the StartGetting call. RaiseSearchingChanged(); m_currentQueryInfo.StartGettingExtantEntries(m_cacheSearch, m_currentID, m_wantExactMatch, m_vernWs, m_cf, m_uf, m_af, m_analWs, m_gl); }
void m_currentQueryInfo_ExtantEntriesCompleted(object sender, EventArgs e) { if (sender != m_currentQueryInfo) { // We ended some obsolete query. We do NOT want to cancel the // search-in-progress thing! (sender as ExtantEntryInfo).Cleanup(); return; } // if disposed...dialog has closed...don't try to reset! // This can easily happen if the search thread is still running // when the dialog is closed. if (IsDisposed) { return; } try { ResetSearch(); if (m_fResetSearchAborted) { return; // we did not complete the reset, will try again. } ClearResetTimer(); m_fResetSearchInProgress = false; } finally { // Any exit path from here means we're done searching. // (The Reset Timer may have fired before we could stop it above... // See LT-7576 and LT-7507.) if (m_currentQueryInfo != null) { m_currentQueryInfo.Cleanup(); m_currentQueryInfo = null; } RaiseSearchingChanged(); } }