protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { // When initialized asynchronously, the current thread may be a background thread at this point. // Do any initialization that requires the UI thread after switching to the UI thread. await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); var rxtLogger = new RxtLogger(); var config = new RxtSettings(); var telemLogger = TelemetryAccessor.Create(rxtLogger, config.TelemetryKey); Logger = new RxtLoggerWithTelemtry(rxtLogger, telemLogger); try { // Set the ServiceProvider of CodeParserBase as it's needed to get settings CodeParserBase.ServiceProvider = this; Logger.RecordInfo(StringRes.Info_ProblemsInstructionsAndLink); Logger.RecordInfo(StringRes.Info_IntializingCommands.WithParams(CoreDetails.GetVersion())); await CreateViewCommand.InitializeAsync(this, Logger); await CopyToClipboardCommand.InitializeAsync(this, Logger); await SendToToolboxCommand.InitializeAsync(this, Logger); await OpenOptionsCommand.InitializeAsync(this, Logger); await SetDatacontextCommand.InitializeAsync(this, Logger); await MoveAllHardCodedStringsToResourceFileCommand.InitializeAsync(this, Logger); await RapidXamlDropHandlerProvider.InitializeAsync(this, Logger); await this.SetUpRunningDocumentTableEventsAsync(cancellationToken); RapidXamlDocumentCache.Initialize(this); } catch (Exception exc) { Logger.RecordException(exc); throw; // Remove for launch. see issue #90 } }
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { // When initialized asynchronously, the current thread may be a background thread at this point. // Do any initialization that requires the UI thread after switching to the UI thread. await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); var rxtLogger = new RxtLogger(); var telemKey = string.Empty; var telemLogger = TelemetryAccessor.Create(rxtLogger, telemKey); Logger = new RxtLoggerWithTelemtry(rxtLogger, telemLogger); try { // Set the ServiceProvider of AnalyzerBase as it's needed to get settings AnalyzerBase.ServiceProvider = this; Logger.RecordInfo(StringRes.Info_IntializingCommands.WithParams(CoreDetails.GetVersion())); await CreateViewCommand.InitializeAsync(this, Logger); await CopyToClipboardCommand.InitializeAsync(this, Logger); await SendToToolboxCommand.InitializeAsync(this, Logger); await OpenOptionsCommand.InitializeAsync(this, Logger); await SetDatacontextCommand.InitializeAsync(this, Logger); await InsertGridRowDefinitionCommand.InitializeAsync(this, Logger); await RapidXamlDropHandlerProvider.InitializeAsync(this, Logger); } catch (Exception exc) { Logger.RecordException(exc); throw; // Remove for launch. see issue #90 } }
public static async Task InitializeAsync(CancellationToken cancellationToken, AsyncPackage package) { // When initialized asynchronously, the current thread may be a background thread at this point. // Do any initialization that requires the UI thread after switching to the UI thread. await package.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); try { if (Logger == null) { var rxtLogger = new RxtLogger(); var config = new RxtSettings(); var telemLogger = TelemetryAccessor.Create(rxtLogger, config.TelemetryKey); Logger = new RxtLoggerWithTelemtry(rxtLogger, telemLogger); var activityLog = await package.GetServiceAsync <SVsActivityLog, IVsActivityLog>(); rxtLogger.VsActivityLog = activityLog; } // The RxtOutputPane is used by all extensions // so using that as a way to tell if any extensions have initialized. // Only want the default info loading once. if (!RxtOutputPane.IsInitialized()) { Logger.RecordNotice(StringRes.Info_ProblemsInstructionsAndLink); Logger.RecordNotice(string.Empty); } } catch (Exception exc) { Logger.RecordException(exc); } }
public RxtLoggerWithTelemtry(RxtLogger logger, TelemetryAccessor telem) { this.Logger = logger; this.Telem = telem; }