Beispiel #1
0
        private void OnDontWarnAgain()
        {
            TelemetryLoggerAccessor.GetLogger(this.host)?.ReportEvent(TelemetryEvent.DontWarnAgainCommandCalled);

            this.settings.ShowServerNuGetTrustWarning = false;
            this.host.ActiveSection?.UserNotifications?.HideNotification(NotificationIds.WarnServerTrustId);
        }
Beispiel #2
0
        private void ExecBrowseToUrl(string url)
        {
            Debug.Assert(this.CanExecBrowseToUrl(url), "Should not be able to execute!");

            TelemetryLoggerAccessor.GetLogger(this.ServiceProvider)?.ReportEvent(TelemetryEvent.BrowseToUrlCommandCommandCalled);

            this.webBrowser.NavigateTo(url);
        }
Beispiel #3
0
        private void Disconnect()
        {
            Debug.Assert(this.CanDisconnect());

            TelemetryLoggerAccessor.GetLogger(this.ServiceProvider)?.ReportEvent(TelemetryEvent.DisconnectCommandCommandCalled);
            // Disconnect all (all being one)
            this.Host.VisualStateManager.GetConnectedServers().ToList().ForEach(c => this.Host.VisualStateManager.SetProjects(c, null));
        }
        private void ToggleShowAllProjects(ServerViewModel server)
        {
            var componentModel = ServiceProvider.GetService <SComponentModel, IComponentModel>();

            TelemetryLoggerAccessor.GetLogger(componentModel)?.ReportEvent(TelemetryEvent.ToggleShowAllProjectsCommandCommandCalled);

            server.ShowAllProjects = !server.ShowAllProjects;
        }
        private void OnBind(ProjectInformation projectInformation)
        {
            Debug.Assert(this.OnBindStatus(projectInformation));

            TelemetryLoggerAccessor.GetLogger(this.host)?.ReportEvent(TelemetryEvent.BindCommandCommandCalled);

            this.workflow.BindProject(projectInformation);
        }
Beispiel #6
0
        private void OnBind(BindCommandArgs args)
        {
            Debug.Assert(this.OnBindStatus(args));

            var componentModel = host.GetService <SComponentModel, IComponentModel>();

            TelemetryLoggerAccessor.GetLogger(componentModel)?.ReportEvent(TelemetryEvent.BindCommandCommandCalled);

            this.workflowExecutor.BindProject(args);
        }
Beispiel #7
0
        private void ExecBrowseToProjectDashboard(ProjectViewModel project)
        {
            Debug.Assert(this.CanExecBrowseToProjectDashboard(project), $"Shouldn't be able to execute {nameof(this.BrowseToProjectDashboardCommand)}");

            TelemetryLoggerAccessor.GetLogger(this.ServiceProvider)?.ReportEvent(TelemetryEvent.BrowseToProjectDashboardCommandCommandCalled);

            var url = this.Host.SonarQubeService.GetProjectDashboardUrl(project.Project.Key);

            this.webBrowser.NavigateTo(url.ToString());
        }
        private void Disconnect()
        {
            Debug.Assert(this.CanDisconnect());

            var componentModel = ServiceProvider.GetService <SComponentModel, IComponentModel>();

            TelemetryLoggerAccessor.GetLogger(componentModel)?.ReportEvent(TelemetryEvent.DisconnectCommandCommandCalled);
            // Disconnect all (all being one)
            this.Host.VisualStateManager.GetConnectedServers().ToList().ForEach(c => this.Host.VisualStateManager.SetProjects(c, null));
            this.Host.SonarQubeService.Disconnect();
        }
        public void TelemetryLoggerAccessor_GetLogger()
        {
            // Arrange
            var loggerInstance = new ConfigurableTelemetryLogger();
            var componentModel = ConfigurableComponentModel.CreateWithExports(
                MefTestHelpers.CreateExport <ITelemetryLogger>(loggerInstance));

            // Act
            ITelemetryLogger logger = TelemetryLoggerAccessor.GetLogger(componentModel);

            // Assert
            logger.Should().Be(loggerInstance, "Failed to find the MEF service: {0}", nameof(ITelemetryLogger));
        }
Beispiel #10
0
        private void OnConnect()
        {
            Debug.Assert(this.OnConnectStatus());
            Debug.Assert(!this.host.VisualStateManager.IsBusy, "Service is in a connecting state");

            TelemetryLoggerAccessor.GetLogger(this.host)?.ReportEvent(TelemetryEvent.ConnectCommandCommandCalled);

            var connectionInfo = this.connectionProvider.GetConnectionInformation(this.LastAttemptedConnection);

            if (connectionInfo != null)
            {
                this.EstablishConnection(connectionInfo);
            }
        }
Beispiel #11
0
        private void OnRefresh(ConnectionInformation useConnection)
        {
            Debug.Assert(this.OnRefreshStatus(useConnection));

            TelemetryLoggerAccessor.GetLogger(this.host)?.ReportEvent(TelemetryEvent.RefreshCommandCommandCalled);

            // We're currently only connected to one server. when this will change we will need to refresh all the connected servers
            ConnectionInformation currentlyConnectedServer = this.host.VisualStateManager.GetConnectedServers().SingleOrDefault();
            ConnectionInformation connectionToRefresh      = useConnection ?? currentlyConnectedServer;

            Debug.Assert(connectionToRefresh != null, "Expecting either to be connected to get a connection to connect to");

            // Any existing connection will be disposed, so create a copy and use it to connect
            this.EstablishConnection(connectionToRefresh.Clone());
        }
        public void TelemetryLoggerAccessor_GetLogger()
        {
            // Setup
            ConfigurableServiceProvider sp = new ConfigurableServiceProvider();
            var loggerInstance             = new ConfigurableTelemetryLogger();
            var componentModel             = ConfigurableComponentModel.CreateWithExports(
                MefTestHelpers.CreateExport <ITelemetryLogger>(loggerInstance));

            sp.RegisterService(typeof(SComponentModel), componentModel);

            // Act
            ITelemetryLogger logger = TelemetryLoggerAccessor.GetLogger(sp);

            // Verify
            Assert.AreSame(loggerInstance, logger, "Failed to find the MEF service: {0}", nameof(ITelemetryLogger));
        }
        private void OnFixConflicts(IEnumerable <ProjectRuleSetConflict> conflicts)
        {
            if (this.OnFixConflictsStatus(conflicts))
            {
                var componentModel = host.GetService <SComponentModel, IComponentModel>();
                TelemetryLoggerAccessor.GetLogger(componentModel)?.ReportEvent(TelemetryEvent.FixConflictsCommandCalled);

                IRuleSetInspector inspector = this.host.GetService <IRuleSetInspector>();
                inspector.AssertLocalServiceIsNotNull();

                ISourceControlledFileSystem sccFileSystem = this.host.GetService <ISourceControlledFileSystem>();
                sccFileSystem.AssertLocalServiceIsNotNull();

                IRuleSetSerializer ruleSetSerializer = this.host.GetService <IRuleSetSerializer>();
                ruleSetSerializer.AssertLocalServiceIsNotNull();

                var fixedConflictsMap = new Dictionary <RuleSetInformation, FixedRuleSetInfo>();
                foreach (RuleSetInformation ruleSetInfo in conflicts.Select(c => c.RuleSetInfo))
                {
                    FixedRuleSetInfo fixInfo = inspector.FixConflictingRules(ruleSetInfo.BaselineFilePath, ruleSetInfo.RuleSetFilePath, ruleSetInfo.RuleSetDirectories);
                    Debug.Assert(fixInfo != null);

                    fixedConflictsMap[ruleSetInfo] = fixInfo;

                    sccFileSystem.QueueFileWrite(fixInfo.FixedRuleSet.FilePath, () =>
                    {
                        ruleSetSerializer.WriteRuleSetFile(fixInfo.FixedRuleSet, fixInfo.FixedRuleSet.FilePath);

                        return(true);
                    });
                }

                this.WriteFixSummaryToOutputWindow(fixedConflictsMap);

                if (sccFileSystem.WriteQueuedFiles())
                {
                    this.Clear();
                }
                else
                {
                    Debug.Fail("Failed to write one or more of the queued files");
                }
            }
        }
        public bool CheckForConflicts()
        {
            Debug.Assert(this.host.UIDispatcher.CheckAccess(), "Expected to be called from the UI thread");

            var conflictsManager = this.host.GetService <IConflictsManager>();
            var conflicts        = conflictsManager.GetCurrentConflicts();

            if (conflicts.Count > 0)
            {
                this.WriteConflictsSummaryToOutputWindow(conflicts);

                TelemetryLoggerAccessor.GetLogger(this.host)?.ReportEvent(TelemetryEvent.FixConflictShow);

                // Let the user know that they have conflicts
                this.host.ActiveSection?.UserNotifications?.ShowNotificationWarning(
                    Strings.RuleSetConflictsDetected,
                    NotificationIds.RuleSetConflictsId,
                    this.CreateFixConflictsCommand(conflicts));
            }

            return(conflicts.Any());
        }
Beispiel #15
0
        private void ToggleShowAllProjects(ServerViewModel server)
        {
            TelemetryLoggerAccessor.GetLogger(this.ServiceProvider)?.ReportEvent(TelemetryEvent.ToggleShowAllProjectsCommandCommandCalled);

            server.ShowAllProjects = !server.ShowAllProjects;
        }