// 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); } }