コード例 #1
0
        private void OnAnalysisRequested(object sender, AnalysisRequestEventArgs args)
        {
            // Handle notification from the single file monitor that the settings file has changed.

            // Re-analysis could take multiple seconds so it's possible that we'll get another
            // file change notification before the re-analysis has completed.
            // If that happens we'll cancel the current re-analysis and start another one.
            lock (reanalysisLockObject)
            {
                reanalysisJob?.Cancel();
                reanalysisProgressHandler?.Dispose();

                var filteredIssueTrackers = FilterIssuesTrackersByPath(this.issueTrackers, args.FilePaths);

                var operations = filteredIssueTrackers
                                 .Select <IIssueTracker, Action>(it => () => it.RequestAnalysis(args.Options))
                                 .ToArray(); // create a fixed list - the user could close a file before the reanalysis completes which would cause the enumeration to change

                reanalysisProgressHandler = new StatusBarReanalysisProgressHandler(vsStatusBar, logger);

                var message = string.Format(CultureInfo.CurrentCulture, Strings.JobRunner_JobDescription_ReaanalyzeDocs, operations.Length);
                reanalysisJob = CancellableJobRunner.Start(message, operations,
                                                           reanalysisProgressHandler, logger);
            }
        }
コード例 #2
0
        public static CancellableJobRunner Start(string jobDescription, IEnumerable <Action> operations, IProgress <JobRunnerProgress> progress, ILogger logger)
        {
            var runner = new CancellableJobRunner(jobDescription, operations, progress, logger);

            runner.Execute()
            .Forget();     // kick off the re-analysis process and return

            return(runner);
        }
コード例 #3
0
        private void OnAnalysisRequested(object sender, EventArgs e)
        {
            // Handle notification from the single file monitor that the settings file has changed.

            // Re-analysis could take multiple seconds so it's possible that we'll get another
            // file change notification before the re-analysis has completed.
            // If that happens we'll cancel the current re-analysis and start another one.
            lock (reanalysisLockObject)
            {
                reanalysisJob?.Cancel();
                reanalysisProgressHandler?.Dispose();

                var operations = this.issueTrackers
                                 .Select <TextBufferIssueTracker, Action>(it => () => it.RequestAnalysis())
                                 .ToArray(); // create a fixed list - the user could close a file before the reanalysis completes which would cause the enumeration to change

                reanalysisProgressHandler = new StatusBarReanalysisProgressHandler(vsStatusBar, logger);

                reanalysisJob = CancellableJobRunner.Start(Strings.JobRunner_JobDescription_ReaanalyzeOpenDocs, operations,
                                                           reanalysisProgressHandler, logger);
            }
        }