// running in UI thread private void ReindexSearchTree(IEnumerable <string> pathsChanged) { lock (this) { this.NumOfIndexingThreads++; } var indexerParams = new BackgroundIndexerParams(this.DocumentHierarchyFactory, this.WorkspaceDirectoryModel.CurrentWorkspaceDirectory, pathsChanged, this.FilesPatternProvider); this.IndexingSearchingModel.ReindexSearchTree(indexerParams); }
public void Execute(IEnumerable <string> pathsChanged) { if (pathsChanged == null) { this.documentHierarchyFactory.CreateDocumentHierarchy(this.workspaceDirectoryModel.CurrentWorkspaceDirectory, this.mainViewModel.AnalyzeDocumentContents); this.clearTreeViewCommand.Execute(); this.syncWithActiveDocumentCommand.Execute(true); } this.mainViewModel.AddNumOfIndexingThreads(1); var indexerParams = new BackgroundIndexerParams(this.documentHierarchyFactory, this.workspaceDirectoryModel.CurrentWorkspaceDirectory, pathsChanged, this.filesPatternProvider); this.ReindexSearchTree(indexerParams); }
// running in UI thread public void ReindexSearchTree(BackgroundIndexerParams indexerParams) { if (indexerParams.PathsChanged == null) { lock (this.BackgroundIndexers) { foreach (var ind in this.BackgroundIndexers) { ind.CancelAsync(); } this.BackgroundIndexers.Clear(); } } var indexer = new BackgroundIndexer(); indexer.RunWorkerCompleted += this.BackgroundIndexerWorkCompleted; indexer.ProgressChanged += this.BackgroundIndexerProgressChanged; indexer.RunWorkerAsync(indexerParams); lock (this.BackgroundIndexers) { this.BackgroundIndexers.Add(indexer); } }