Inheritance: IVsEditorFactory, IDisposable
示例#1
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            OpenLogFileCommands.Initialize(this);
            base.Initialize();

            string path      = Assembly.GetExecutingAssembly().Location;
            var    configMap = new ExeConfigurationFileMap();

            configMap.ExeConfigFilename = Path.Combine(Path.GetDirectoryName(path), "App.config");
            AppConfig = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(configMap, ConfigurationUserLevel.None);

#if DEBUG
            string telemetryKey = SarifViewerPackage.AppConfig.AppSettings.Settings["TelemetryInstrumentationKey_Debug"].Value;
#else
            string telemetryKey = SarifViewerPackage.AppConfig.AppSettings.Settings["TelemetryInstrumentationKey_Release"].Value;
#endif

            TelemetryConfiguration configuration = new TelemetryConfiguration()
            {
                InstrumentationKey = telemetryKey
            };
            TelemetryProvider.Initialize(configuration);
            TelemetryProvider.WriteEvent(TelemetryEvent.ViewerExtensionLoaded);

            _sarifEditorFactory = new SarifEditorFactory();
            RegisterEditorFactory(_sarifEditorFactory);

            CodeAnalysisResultManager.Instance.Register();
            Microsoft.Sarif.Viewer.SarifToolWindowCommand.Initialize(this);
        }
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            OpenLogFileCommands.Initialize(this);
            base.Initialize();

            _sarifEditorFactory = new SarifEditorFactory();
            RegisterEditorFactory(_sarifEditorFactory);

            CodeAnalysisResultManager.Instance.Register();
        }
示例#3
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            OpenLogFileCommands.Initialize(this);
            base.Initialize();

            ServiceCreatorCallback callback = new ServiceCreatorCallback(CreateService);

            ((IServiceContainer)this).AddService(typeof(SLoadSarifLogService), callback, true);

            string path      = Assembly.GetExecutingAssembly().Location;
            var    configMap = new ExeConfigurationFileMap();

            configMap.ExeConfigFilename = Path.Combine(Path.GetDirectoryName(path), "App.config");
            AppConfig = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(configMap, ConfigurationUserLevel.None);

#if DEBUG
            string telemetryKey = SarifViewerPackage.AppConfig.AppSettings.Settings["TelemetryInstrumentationKey_Debug"].Value;
#else
            string telemetryKey = SarifViewerPackage.AppConfig.AppSettings.Settings["TelemetryInstrumentationKey_Release"].Value;
#endif

            TelemetryConfiguration configuration = new TelemetryConfiguration()
            {
                InstrumentationKey = telemetryKey
            };
            TelemetryProvider.Initialize(configuration);
            TelemetryProvider.WriteEvent(TelemetryEvent.ViewerExtensionLoaded);

            _sarifEditorFactory = new SarifEditorFactory();
            RegisterEditorFactory(_sarifEditorFactory);

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            CodeAnalysisResultManager.Instance.Register();
            SarifToolWindowCommand.Initialize(this);
            ErrorList.ErrorListCommand.Initialize(this);

            return;
        }