Exemplo n.º 1
0
        public TelemetryManager(IActiveSolutionBoundTracker solutionBindingTracker, ITelemetryDataRepository telemetryRepository, IVsVersionProvider vsVersionProvider,
                                ILogger logger, ITelemetryClient telemetryClient, ITelemetryTimer telemetryTimer, IKnownUIContexts knownUIContexts,
                                ICurrentTimeProvider currentTimeProvider)
        {
            this.solutionBindingTracker = solutionBindingTracker;
            this.telemetryRepository    = telemetryRepository;
            this.logger              = logger;
            this.telemetryClient     = telemetryClient;
            this.telemetryTimer      = telemetryTimer;
            this.knownUIContexts     = knownUIContexts;
            this.currentTimeProvider = currentTimeProvider;

            vsVersion = vsVersionProvider.Version;

            if (this.telemetryRepository.Data.InstallationDate == DateTimeOffset.MinValue)
            {
                this.telemetryRepository.Data.InstallationDate = currentTimeProvider.Now;
                this.telemetryRepository.Save();
            }

            if (IsAnonymousDataShared)
            {
                EnableAllEvents();
            }
        }
Exemplo n.º 2
0
        public TelemetryManager(IActiveSolutionBoundTracker solutionBindingTracker, ITelemetryDataRepository telemetryRepository,
                                ILogger logger, ITelemetryClient telemetryClient, ITelemetryTimer telemetryTimer, IKnownUIContexts knownUIContexts)
        {
            if (solutionBindingTracker == null)
            {
                throw new ArgumentNullException(nameof(solutionBindingTracker));
            }
            if (telemetryRepository == null)
            {
                throw new ArgumentNullException(nameof(telemetryRepository));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (telemetryClient == null)
            {
                throw new ArgumentNullException(nameof(telemetryClient));
            }
            if (telemetryTimer == null)
            {
                throw new ArgumentNullException(nameof(telemetryTimer));
            }
            if (knownUIContexts == null)
            {
                throw new ArgumentNullException(nameof(knownUIContexts));
            }

            this.solutionBindingTracker = solutionBindingTracker;
            this.telemetryClient        = telemetryClient;
            this.logger              = logger;
            this.telemetryTimer      = telemetryTimer;
            this.telemetryRepository = telemetryRepository;
            this.knownUIContexts     = knownUIContexts;

            if (this.telemetryRepository.Data.InstallationDate == DateTimeOffset.MinValue)
            {
                this.telemetryRepository.Data.InstallationDate = DateTimeOffset.Now; // TODO: Use some mockable clock
                this.telemetryRepository.Save();
            }

            if (IsAnonymousDataShared)
            {
                EnableAllEvents();
            }
        }
        public TelemetryManager(IActiveSolutionBoundTracker solutionBindingTracker, ITelemetryDataRepository telemetryRepository,
                                ILogger logger, ITelemetryClient telemetryClient, ITelemetryTimer telemetryTimer, IKnownUIContexts knownUIContexts,
                                ICurrentTimeProvider currentTimeProvider)
        {
            this.solutionBindingTracker = solutionBindingTracker ?? throw new ArgumentNullException(nameof(solutionBindingTracker));
            this.telemetryRepository    = telemetryRepository ?? throw new ArgumentNullException(nameof(telemetryRepository));
            this.logger              = logger ?? throw new ArgumentNullException(nameof(logger));
            this.telemetryClient     = telemetryClient ?? throw new ArgumentNullException(nameof(telemetryClient));
            this.telemetryTimer      = telemetryTimer ?? throw new ArgumentNullException(nameof(telemetryTimer));
            this.knownUIContexts     = knownUIContexts ?? throw new ArgumentNullException(nameof(knownUIContexts));
            this.currentTimeProvider = currentTimeProvider ?? throw new ArgumentNullException(nameof(currentTimeProvider));

            if (this.telemetryRepository.Data.InstallationDate == DateTimeOffset.MinValue)
            {
                this.telemetryRepository.Data.InstallationDate = currentTimeProvider.Now;
                this.telemetryRepository.Save();
            }

            if (IsAnonymousDataShared)
            {
                EnableAllEvents();
            }
        }