// runs on a separate thread (created in constructor)
 private void ChangeNotifier()
 {
     if (Thread.CurrentThread.Name == null)
     {
         Thread.CurrentThread.Name = this.Name;
     }
     while (true)
     {
         Thread.Sleep(200);
         if (CancellationTokenSource.Token.IsCancellationRequested)
         {
             return;
         }
         FileSystemChangedInfo changedInfo = null;
         lock (this)
         {
             if (this.ChangePool.Any())
             {
                 IList<ChangePoolEntry> pathsChanged = RemoveSubdirectories(ChangePool);
                 changedInfo = new FileSystemChangedInfo(pathsChanged);
                 this.ChangePool.Clear();
             }
         }
         if (changedInfo != null && this.FileSystemChanged != null)
         {
             FileSystemChanged(this, changedInfo);
         }
     }
 }
예제 #2
0
 private void ReindexOnFileSystemChanged(object sender, FileSystemChangedInfo changedInfo)
 {
     var workspaceDirectory = this.workspaceDirectoryModel.CurrentWorkspaceDirectory;
     var pathsChanged = changedInfo.PathsChanged.Where(p => p.RootPath == workspaceDirectory).Select(p => p.PathChanged).ToList();
     if (!pathsChanged.Any())
     {
         return;
     }
     if (pathsChanged.Contains(workspaceDirectory, StringComparer.InvariantCultureIgnoreCase))
     {
         pathsChanged = null;
     }
     Logger.Debug("OnFileSystemChanged: " + (pathsChanged == null ? "root" : string.Join(",", pathsChanged)));
     this.commandExecutor.ExecuteWithParam<ReindexSearchTreeCommand, IEnumerable<string>>(pathsChanged);
 }
 private void OnIseFileChangedBatch(object sender, FileSystemChangedInfo changedInfo)
 {
     foreach (var changePoolEntry in changedInfo.PathsChanged)
     {
         var pathChanged = changePoolEntry.PathChanged;
         bool pathIgnored;
         lock (this.PathsToIgnore)
         {
             pathIgnored = this.PathsToIgnore.Remove(pathChanged);
         }
         if (!pathIgnored)
         {
             this.ReloadFileOpenInIse(changePoolEntry);
         }
     }
 }
예제 #4
0
 private void ReindexOnFileSystemChanged(object sender, FileSystemChangedInfo changedInfo)
 {
     var workspaceDirectory = this.WorkspaceDirectoryModel.CurrentWorkspaceDirectory;
     var pathsChanged = changedInfo.PathsChanged.Where(p => p.RootPath == workspaceDirectory).Select(p => p.PathChanged).ToList();
     if (!pathsChanged.Any())
     {
         return;
     }
     if (pathsChanged.Contains(workspaceDirectory, StringComparer.InvariantCultureIgnoreCase))
     {
         pathsChanged = null;
     }
     Logger.Debug("OnFileSystemChanged: " + (pathsChanged == null ? "root" : string.Join(",", pathsChanged)));
     Application.Current.Dispatcher.Invoke(() => this.ReindexSearchTree(pathsChanged));
 }