private async void Refresh() { Control.Cursor = Cursors.WaitCursor; try { if (VBE != null) { _results = await _inspector.FindIssuesAsync(VBE.ActiveVBProject); Control.SetContent(_results.Select(item => new CodeInspectionResultGridViewItem(item)) .OrderBy(item => item.Component) .ThenBy(item => item.Line)); if (!_results.Any()) { Control.QuickFixButton.Enabled = false; } } } catch (COMException) { // swallow } finally { Control.Cursor = Cursors.Default; } }
private async void _state_StateChanged(object sender, EventArgs e) { Debug.WriteLine("InspectionResultsViewModel handles StateChanged..."); if (_state.Status != ParserState.Ready) { IsBusy = false; return; } Debug.WriteLine("Running code inspections..."); IsBusy = true; var results = await _inspector.FindIssuesAsync(_state, CancellationToken.None); _dispatcher.Invoke(() => { Results.Clear(); foreach (var codeInspectionResult in results) { Results.Add(codeInspectionResult); } CanRefresh = true; IsBusy = false; SelectedItem = null; }); }
private async void RefreshAsync() { var result = await _inspector.FindIssuesAsync(_vbe.ActiveVBProject); _issues = result.ToList(); var hasIssues = _issues.Any(); _quickFixButton.Enabled = hasIssues; SetQuickFixTooltip(); _navigateNextButton.Enabled = hasIssues; _navigatePreviousButton.Enabled = hasIssues; }
private async void RefreshInspections() { var stopwatch = Stopwatch.StartNew(); IsBusy = true; var results = (await _inspector.FindIssuesAsync(_state, CancellationToken.None)).ToList(); if (GroupByInspectionType) { results = results.OrderBy(o => o.Inspection.InspectionType) .ThenBy(t => t.Inspection.Name) .ThenBy(t => t.QualifiedSelection.QualifiedName.Name) .ThenBy(t => t.QualifiedSelection.Selection.StartLine) .ThenBy(t => t.QualifiedSelection.Selection.StartColumn) .ToList(); } else { results = results.OrderBy(o => o.QualifiedSelection.QualifiedName.Name) .ThenBy(t => t.Inspection.Name) .ThenBy(t => t.QualifiedSelection.Selection.StartLine) .ThenBy(t => t.QualifiedSelection.Selection.StartColumn) .ToList(); } Results = new ObservableCollection <IInspectionResult>(results); UiDispatcher.Invoke(() => { try { IsBusy = false; OnPropertyChanged("EmptyUIRefreshVisibility"); IsRefreshing = false; SelectedItem = null; } catch (Exception exception) { Logger.Error(exception, "Exception thrown trying to refresh the inspection results view on th UI thread."); } }); stopwatch.Stop(); LogManager.GetCurrentClassLogger().Trace("Inspections loaded in {0}ms", stopwatch.ElapsedMilliseconds); }
private async Task RefreshAsync(CancellationToken token) { try { var projectParseResult = await _inspector.Parse(VBE.ActiveVBProject, this); _results = await _inspector.FindIssuesAsync(projectParseResult, token); } catch (TaskCanceledException) { // If FindIssuesAsync is canceled, we can leave the old results or // create a new List. Let's leave the old ones for now. } catch (COMException) { // burp } }
private async void RefreshAsync(CancellationToken token) { try { var projectParseResult = await _inspector.Parse(_vbe.ActiveVBProject, this); _issues = await _inspector.FindIssuesAsync(projectParseResult, token); } catch (COMException) { // burp } var hasIssues = _issues.Any(); _quickFixButton.Enabled = hasIssues; SetQuickFixTooltip(); _navigateNextButton.Enabled = hasIssues; _navigatePreviousButton.Enabled = hasIssues; }
private async void _state_StateChanged(object sender, EventArgs e) { _logger.Debug("InspectionResultsViewModel handles StateChanged..."); if (_state.Status != ParserState.Ready) { IsBusy = false; return; } _logger.Debug("Running code inspections..."); IsBusy = true; var results = (await _inspector.FindIssuesAsync(_state, CancellationToken.None)).ToList(); if (GroupByInspectionType) { results = results.OrderBy(o => o.Inspection.InspectionType) .ThenBy(t => t.Inspection.Name) .ThenBy(t => t.QualifiedSelection.QualifiedName.Name) .ThenBy(t => t.QualifiedSelection.Selection.StartLine) .ThenBy(t => t.QualifiedSelection.Selection.StartColumn) .ToList(); } else { results = results.OrderBy(o => o.QualifiedSelection.QualifiedName.Name) .ThenBy(t => t.Inspection.Name) .ThenBy(t => t.QualifiedSelection.Selection.StartLine) .ThenBy(t => t.QualifiedSelection.Selection.StartColumn) .ToList(); } UiDispatcher.Invoke(() => { Results = new ObservableCollection <ICodeInspectionResult>(results); CanRefresh = true; IsBusy = false; SelectedItem = null; }); }
private async void RefreshInspections() { var stopwatch = Stopwatch.StartNew(); IsBusy = true; var results = (await _inspector.FindIssuesAsync(_state, CancellationToken.None)).ToList(); if (GroupByInspectionType) { results = results.OrderBy(o => o.Inspection.InspectionType) .ThenBy(t => t.Inspection.Name) .ThenBy(t => t.QualifiedSelection.QualifiedName.Name) .ThenBy(t => t.QualifiedSelection.Selection.StartLine) .ThenBy(t => t.QualifiedSelection.Selection.StartColumn) .ToList(); } else { results = results.OrderBy(o => o.QualifiedSelection.QualifiedName.Name) .ThenBy(t => t.Inspection.Name) .ThenBy(t => t.QualifiedSelection.Selection.StartLine) .ThenBy(t => t.QualifiedSelection.Selection.StartColumn) .ToList(); } UiDispatcher.Invoke(() => { Results = new ObservableCollection <ICodeInspectionResult>(results); CanRefresh = true; IsBusy = false; SelectedItem = null; }); stopwatch.Stop(); LogManager.GetCurrentClassLogger().Trace("Inspections loaded in {0}ms", stopwatch.ElapsedMilliseconds); }