Example #1
0
        public void RunWorkerSync(BackgroundSearcherParams argument)
        {
            var args = new DoWorkEventArgs(argument);

            this.RunSearching(this, args);
            this.OnRunWorkerCompleted(new RunWorkerCompletedEventArgs(args.Result, null, args.Cancel));
        }
Example #2
0
 private void RunActualSearch(BackgroundSearcherParams searcherParams, DoWorkEventArgs e)
 {
     if (this.CancellationPending)
     {
         e.Cancel = true;
         return;
     }
     Logger.Info(string.Format("Searching started, path: {0}, text: {1} ", searcherParams.Path ?? "null", searcherParams.SearchOptions.SearchText));
     try
     {
         INode result = this.DocumentHierarchySearcher.GetDocumentHierarchyViewNodeProjection(searcherParams.DocumentHierarchy, searcherParams.Path, searcherParams.SearchOptions, this);
         e.Result = new SearcherResult(this.StartTimestamp, result, searcherParams.Path, searcherParams.SearchOptions);
     }
     catch (OperationCanceledException)
     {
         e.Cancel = true;
     }
 }
 private void RunActualSearch(BackgroundSearcherParams searcherParams, DoWorkEventArgs e)
 {
     if (this.CancellationPending)
     {
         e.Cancel = true;
         return;
     }
     Logger.Info(string.Format("Searching started, path: {0}, text: {1} ", searcherParams.Path ?? "null", searcherParams.SearchOptions.SearchText));
     try
     {
         INode result = searcherParams.DocumentHierarchySearcher.GetDocumentHierarchyViewNodeProjection(searcherParams.Path, searcherParams.SearchOptions, this);
         e.Result = new SearcherResult(this.StartTimestamp, result, searcherParams.Path, searcherParams.SearchOptions);
     }
     catch (OperationCanceledException)
     {
         e.Cancel = true;
     }
 }
 // running in Indexing or UI thread
 public void RunSearch(BackgroundSearcherParams searcherParams)
 {
     if (searcherParams.Path == null)
     {
         lock (BackgroundSearchers)
         {
             foreach (var sear in BackgroundSearchers)
             {
                 sear.CancelAsync();
             }
             BackgroundSearchers.Clear();
         }
     }
     var searcher = new BackgroundSearcher();
     searcher.RunWorkerCompleted += BackgroundSearcherWorkCompleted;
     if (searcherParams.Path != null)
     {
         searcher.RunWorkerSync(searcherParams);
     }
     else
     {
         searcher.RunWorkerAsync(searcherParams);
         lock (BackgroundSearchers)
         {
             BackgroundSearchers.Add(searcher);
         }
     }
 }
 // running in Indexing or UI thread
 private void RunSearch(string path = null)
 {
     lock (this)
     {
         this.NumOfSearchingThreads++;
     }
     if (path == null)
     {
         this.ClearTreeView();
     }
     var searcherParams = new BackgroundSearcherParams(this.DocumentHierarchySearcher, this.SearchOptions, path);
     this.IndexingSearchingModel.RunSearch(searcherParams);
 }
 public void RunWorkerSync(BackgroundSearcherParams argument)
 {
     var args = new DoWorkEventArgs(argument);
     this.RunSearching(this, args);
     this.OnRunWorkerCompleted(new RunWorkerCompletedEventArgs(args.Result, null, args.Cancel));
 }