public void StartSessions(SearchContext context) { if (m_CancelSource != null) { m_CancelSource.Dispose(); m_CancelSource = null; } m_CancelSource = new System.Threading.CancellationTokenSource(); currentSessionContext = new SearchSessionContext(context); }
/// <summary> /// Hard reset an async search session. /// </summary> /// <param name="itemEnumerator">The enumerator that will yield new search results. This object can be an IEnumerator or IEnumerable</param> /// <param name="maxFetchTimePerProviderMs">The amount of time allowed to yield new results.</param> /// <remarks>Normally async search sessions are re-used per search provider.</remarks> public void Reset(SearchSessionContext context, object itemEnumerator, long maxFetchTimePerProviderMs = k_MaxTimePerUpdate, long sessionTimeOutMs = k_DefaultSessionTimeOut) { // Remove and add the event handler in case it was already removed. Stop(); searchInProgress = true; m_Context = context; maxFetchTimePerUpdate = maxFetchTimePerProviderMs; m_SessionTimeOut = sessionTimeOutMs; m_SessionTimer.Reset(); if (itemEnumerator != null) { lock (this) m_ItemsEnumerator = new SearchEnumerator <SearchItem>(itemEnumerator); Utils.tick += OnUpdate; } }
public SearchSession(SearchSessionContext context, SearchProvider provider) { m_Context = context; m_Provider = provider; }