private void NoSolutionContext_UIContextChanged(object sender, UIContextChangedEventArgs e) { if (e.Activated) { ShowStartPage( ); } }
private void OnSolutionBuilding(object sender, UIContextChangedEventArgs e) { if (e.Activated) { this.OnSolutionBuilding(); } }
private void OnVBProjectContextChanged(object sender, UIContextChangedEventArgs e) { if (e.Activated) { LanguageAnalyzed(SonarLanguageKeys.VBNet); } }
void UIContextChanged(object sender, UIContextChangedEventArgs e) { Guard.ArgumentNotNull(e, nameof(e)); ActiveRepo = null; UIContextChanged(e.Activated, false); }
private void OnAnalysisRun(object sender, UIContextChangedEventArgs e) { if (e.Activated) { this.Update(); } }
async void DebuggingChanged(object sender, UIContextChangedEventArgs e) { if (e.Activated) { // We just started debugging, so publish the DebugAttacher class // and wait for a request. IChannel channel; EventWaitHandle notifyEvent; if (!TesterDebugAttacherShared.OpenChannel(10, out channel, out notifyEvent)) { return; } try { // Wait for the signal that we've either attached to our // client, or we've aborted the wait. All we do after this // is unregister the channel, so it doesn't really matter // which it is. var signaled = await Task.Run(() => notifyEvent.WaitOne(TimeSpan.FromSeconds(30))); } finally { notifyEvent.Dispose(); TesterDebugAttacherShared.CloseChannel(channel); } } else { // We were debugging, but now we've stopped // Abort waiting in case we stopped within the timeout TesterDebugAttacherShared.CancelWait(); } }
private void OnSolutionExistsAndFullyLoadedContext(object sender, UIContextChangedEventArgs e) { if (e.Activated) { // unsubscribe from it KnownUIContexts.SolutionExistsAndFullyLoadedContext.UIContextChanged -= OnSolutionExistsAndFullyLoadedContext; // load components LoadComponents(); } }
private void OnUiContextChanged(object sender, UIContextChangedEventArgs e) { var context = sender as UIContext; Guid contextId = GetId(context); _contexts.TryGetValue(contextId, out string contextName); _logger?.LogEventMessage($"Context: {contextName}, Id: {contextId:D}, Activated: {e.Activated}"); ContextChanged?.Invoke(this, new UiContextChangedEventArgs(contextId, e.Activated)); }
private void OnSolutionBuild(object sender, UIContextChangedEventArgs e) { if (e.Activated) { _diagnosticProvider.OnSolutionBuildStarted(); } else { _diagnosticProvider.OnSolutionBuildCompleted(); } }
private void OnSolutionExistsAndFullyLoadedContext(object sender, UIContextChangedEventArgs e) { ThreadHelper.ThrowIfNotOnUIThread(); if (e.Activated) { // unsubscribe from it KnownUIContexts.SolutionExistsAndFullyLoadedContext.UIContextChanged -= OnSolutionExistsAndFullyLoadedContext; // load components LoadComponentsInUIContext(CancellationToken.None); } }
private void OnSolutionExistsAndFullyLoadedContext(object sender, UIContextChangedEventArgs e) { ForegroundObject.AssertIsForeground(); if (e.Activated) { // unsubscribe from it KnownUIContexts.SolutionExistsAndFullyLoadedContext.UIContextChanged -= OnSolutionExistsAndFullyLoadedContext; // load components LoadComponentsInUIContext(); } }
private void OnSolutionExistsAndFullyLoadedContext(object sender, UIContextChangedEventArgs e) { ForegroundObject.AssertIsForeground(); if (e.Activated) { // unsubscribe from it KnownUIContexts.SolutionExistsAndFullyLoadedContext.UIContextChanged -= OnSolutionExistsAndFullyLoadedContext; // load components LoadComponentsInUIContext(CancellationToken.None); } }
private void ContextChangedWorker(UIContextChangedEventArgs e, string operation) { if (_notificationService == null) { return; } TryCancelPendingNotification(operation); if (e.Activated) { _operations[operation] = _notificationService.Start(operation); } }
private void OnAnalysisRun(object sender, UIContextChangedEventArgs e) { if (!e.Activated) { return; } var lastAnalysisDate = telemetryRepository.Data.LastSavedAnalysisDate; if (!DateTime.Now.IsSameDay(lastAnalysisDate)) { telemetryRepository.Data.LastSavedAnalysisDate = DateTime.Now; telemetryRepository.Data.NumberOfDaysOfUse++; telemetryRepository.Save(); } }
private void OnAnalysisRun(object sender, UIContextChangedEventArgs e) { if (!e.Activated) { return; } var lastAnalysisDate = this.telemetryRepository.Data.LastSavedAnalysisDate; if (lastAnalysisDate == DateTime.MinValue || (DateTime.Now - lastAnalysisDate).TotalDays >= 1) { this.telemetryRepository.Data.LastSavedAnalysisDate = DateTime.Now; this.telemetryRepository.Data.NumberOfDaysOfUse++; this.telemetryRepository.Save(); } }
private void SolutionBuildingContextChanged(object sender, UIContextChangedEventArgs e) { if (_notificationService != null) { if (e.Activated) { if (_operation != null) { _operation.Dispose(); } _operation = _notificationService.Start("Solution Building"); } else if (_operation != null) { _operation.Done(); _operation.Dispose(); _operation = null; } } }
internal void OnSolutionBuild(object sender, UIContextChangedEventArgs e) { if (e.Activated) { // build just started, create the state and fire build in progress event. var state = GetOrCreateInprogressState(); return; } // building is done. reset the state // and get local copy of inprogress state var inprogressState = ClearInprogressState(); // enqueue build/live sync in the queue. var asyncToken = _listener.BeginAsyncOperation("OnSolutionBuild"); _taskQueue.ScheduleTask(async() => { // nothing to do if (inprogressState == null) { return; } _lastBuiltResult = inprogressState.GetBuildDiagnostics(); // we are about to update live analyzer data using one from build. // pause live analyzer using (var operation = _notificationService.Start("BuildDone")) { if (_diagnosticService is DiagnosticAnalyzerService diagnosticService) { await CleanupAllLiveErrorsAsync(diagnosticService, inprogressState.GetProjectsWithoutErrors()).ConfigureAwait(false); await SyncBuildErrorsAndReportAsync(diagnosticService, inprogressState).ConfigureAwait(false); } inprogressState.Done(); } }).CompletesAsyncOperation(asyncToken); }
internal void OnSolutionBuild(object sender, UIContextChangedEventArgs e) { if (e.Activated) { return; } var asyncToken = _listener.BeginAsyncOperation("OnSolutionBuild"); _taskQueue.ScheduleTask(() => { // build is done, remove live error and report errors IDictionary <ProjectId, IList <DiagnosticData> > liveProjectErrors; IDictionary <DocumentId, IList <DiagnosticData> > liveDocumentErrors; GetLiveProjectAndDocumentErrors(out liveProjectErrors, out liveDocumentErrors); using (var documentIds = SharedPools.Default <List <DocumentId> >().GetPooledObject()) using (var projectIds = SharedPools.Default <List <ProjectId> >().GetPooledObject()) { lock (_gate) { documentIds.Object.AddRange(_documentToDiagnosticsMap.Keys); projectIds.Object.AddRange(_projectToDiagnosticsMap.Keys); } foreach (var documentId in documentIds.Object) { var errors = liveDocumentErrors.GetValueOrDefault(documentId); RemoveBuildErrorsDuplicatedByLiveErrorsAndReport(documentId.ProjectId, documentId, errors, reportOnlyIfChanged: false); } foreach (var projectId in projectIds.Object) { var errors = liveProjectErrors.GetValueOrDefault(projectId); RemoveBuildErrorsDuplicatedByLiveErrorsAndReport(projectId, null, errors, reportOnlyIfChanged: false); } } }).CompletesAsyncOperation(asyncToken); }
private void SolutionOpeningContextChanged(object sender, UIContextChangedEventArgs e) { ContextChangedWorker(e, "Solution Opening"); }
private void SolutionBuildingContextChanged(object sender, UIContextChangedEventArgs e) => ContextChanged(e.Activated, SolutionBuilding);
void UIContextChanged(object sender, UIContextChangedEventArgs e) { ActiveRepo = null; UIContextChanged(e.Activated, false); }
private void SolutionExistsAndFullyLoadedContext_UIContextChanged(object sender, UIContextChangedEventArgs e) { // KnownUIContexts.SolutionExistsAndFullyLoadedContext.IsActive == true if (e.Activated) { this.UpdateCaptionOfDeferredProjects(); this.EnumerateProjectsInSolution(); } }
internal void OnSolutionBuild(object sender, UIContextChangedEventArgs e) { if (e.Activated) { // build just started, create the state and fire build in progress event. var state = GetOrCreateInprogressState(); return; } // get local copy of inprogress state var inprogressState = _state; // building is done. reset the state. _state = null; // enqueue build/live sync in the queue. var asyncToken = _listener.BeginAsyncOperation("OnSolutionBuild"); _taskQueue.ScheduleTask(async() => { // nothing to do if (inprogressState == null) { return; } _lastBuiltResult = inprogressState.GetBuildDiagnostics(); // we are about to update live analyzer data using one from build. // pause live analyzer using (var operation = _notificationService.Start("BuildDone")) { // we will have a race here since we can't track version of solution the out of proc build actually used. // result of the race will be us dropping some diagnostics from the build to the floor. var solution = _workspace.CurrentSolution; await CleanupAllLiveErrorsIfNeededAsync(solution, inprogressState).ConfigureAwait(false); var supportedIdMap = GetSupportedLiveDiagnosticId(solution, inprogressState); Func <DiagnosticData, bool> liveDiagnosticChecker = d => { // REVIEW: we probably need a better design on de-duplicating live and build errors. or don't de-dup at all. // for now, we are special casing compiler error case. var project = solution.GetProject(d.ProjectId); if (project == null) { // project doesn't exist return(false); } // REVIEW: current design is that we special case compiler analyzer case and we accept only document level // diagnostic as live. otherwise, we let them be build errors. we changed compiler analyzer accordingly as well // so that it doesn't report project level diagnostic as live errors. if (_diagnosticService.IsCompilerDiagnostic(project.Language, d) && d.DocumentId == null) { // compiler error but project level error return(false); } HashSet <string> set; if (supportedIdMap.TryGetValue(d.ProjectId, out set) && set.Contains(d.Id)) { return(true); } return(false); }; await SyncBuildErrorsAndReportAsync(solution, liveDiagnosticChecker, inprogressState.GetDocumentAndErrors(solution)).ConfigureAwait(false); await SyncBuildErrorsAndReportAsync(solution, liveDiagnosticChecker, inprogressState.GetProjectAndErrors(solution)).ConfigureAwait(false); inprogressState.Done(); } }).CompletesAsyncOperation(asyncToken); }
void UIContextChanged(object sender, UIContextChangedEventArgs e) { UIContextChanged(e.Activated); }
internal void OnSolutionBuild(object sender, UIContextChangedEventArgs e) { if (e.Activated) { // build just started, create the state and fire build in progress event. var state = GetOrCreateInprogressState(); return; } // get local copy of inprogress state var inprogressState = _state; // building is done. reset the state. Interlocked.CompareExchange(ref _state, null, inprogressState); // enqueue build/live sync in the queue. var asyncToken = _listener.BeginAsyncOperation("OnSolutionBuild"); _taskQueue.ScheduleTask(async() => { // nothing to do if (inprogressState == null) { return; } _lastBuiltResult = inprogressState.GetBuildDiagnostics(); // we are about to update live analyzer data using one from build. // pause live analyzer using (var operation = _notificationService.Start("BuildDone")) { Func <DiagnosticData, bool> liveDiagnosticChecker = d => { // REVIEW: we probably need a better design on de-duplicating live and build errors. or don't de-dup at all. // for now, we are special casing compiler error case. var project = inprogressState.Solution.GetProject(d.ProjectId); if (project == null) { // project doesn't exist return(false); } // REVIEW: current design is that we special case compiler analyzer case and we accept only document level // diagnostic as live. otherwise, we let them be build errors. we changed compiler analyzer accordingly as well // so that it doesn't report project level diagnostic as live errors. if (_diagnosticService.IsCompilerDiagnostic(project.Language, d) && d.DocumentId == null) { // compiler error but project level error return(false); } if (inprogressState.SupportedDiagnosticId(d.ProjectId, d.Id)) { return(true); } return(false); }; var diagnosticService = _diagnosticService as DiagnosticAnalyzerService; if (diagnosticService != null) { await CleanupAllLiveErrorsIfNeededAsync(diagnosticService, inprogressState.Solution, inprogressState).ConfigureAwait(false); await SyncBuildErrorsAndReportAsync(diagnosticService, inprogressState.Solution, inprogressState.GetLiveDiagnosticsPerProject(liveDiagnosticChecker)).ConfigureAwait(false); } inprogressState.Done(); } }).CompletesAsyncOperation(asyncToken); }
void tfsProviderContext_UIContextChanged(object sender, UIContextChangedEventArgs e) { SetVisibility(); }
private void SolutionOpeningContextChanged(object sender, UIContextChangedEventArgs e) { ContextChanged(e.Activated, SolutionOpening); }
void UIContextChanged(object sender, UIContextChangedEventArgs e) { ActiveRepo = null; UIContextChanged(e.Activated); }