private void Initialize(string lang, INodesForIndexingProvider nfip, bool isFullRestart) { if (!_isInitialized) { lock (this) { if (!_isInitialized) { isStopIndexingRequested = false; _isInitialized = false; OnIndexingStarted(); NodesForIndexingProvider = nfip; CurrentLanguage = lang; CurrentView = nfip.GetHashKeyForIndex(); if (isFullRestart || IsNeedsReIndexing()) { DoInitialize(isFullRestart); ThreadSafeQueue <Node> queuedNodes = new ThreadSafeQueue <Node>(NodesForIndexingProvider.GetNodesForIndexing()); RunFullIndexingInSeparateThread(queuedNodes); } } } } }
/// <summary> /// </summary> public void ChangeToView(INodesForIndexingProvider newNodesForIndexingProvider) { lock (this) { try { NodesForIndexingProvider = newNodesForIndexingProvider; CurrentView = NodesForIndexingProvider.GetHashKeyForIndex(); if (IsNeedsReIndexing()) { _isInitialized = false; Initialize(CurrentLanguage, NodesForIndexingProvider, false); } } catch (Exception e) { Debug.Write(new Exception("AbstractIndexMgr: An error occurred in ChangeToView", e)); } } }
private void Initialize(string lang, INodesForIndexingProvider nfip, bool isFullRestart) { if (!_isInitialized) { lock (this) { if (!_isInitialized) { isStopIndexingRequested = false; _isInitialized = false; OnIndexingStarted(); NodesForIndexingProvider = nfip; CurrentLanguage = lang; CurrentView = nfip.GetHashKeyForIndex(); if (isFullRestart || IsNeedsReIndexing()) { DoInitialize(isFullRestart); ThreadSafeQueue<Node> queuedNodes = new ThreadSafeQueue<Node>(NodesForIndexingProvider.GetNodesForIndexing()); RunFullIndexingInSeparateThread(queuedNodes); } } } } }