/// <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 relies on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            Container = VsContainerBuilder.CreateContainer(this);

            var currentIdeIntegration = CurrentIdeIntegration;

            if (currentIdeIntegration != null)
            {
                InstallServices installServices = Container.Resolve <InstallServices>();
                installServices.OnPackageLoad(currentIdeIntegration.Value);
            }

            OleMenuCommandService menuCommandService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (menuCommandService != null)
            {
                foreach (var menuCommandHandler in Container.Resolve <IDictionary <SpecFlowCmdSet, MenuCommandHandler> >())
                {
                    menuCommandHandler.Value.RegisterTo(menuCommandService, menuCommandHandler.Key);
                }
            }
        }
예제 #2
0
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            Container = VsContainerBuilder.CreateContainer(this);
            TelemetryConfiguration.Active.InstrumentationKey = AppInsightsInstrumentationKey.Key;

            var currentIdeIntegration = CurrentIdeIntegration;

            if (currentIdeIntegration != null)
            {
                InstallServices installServices = Container.Resolve <InstallServices>();
                installServices.OnPackageLoad(currentIdeIntegration.Value);
            }

            OleMenuCommandService menuCommandService = await GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (menuCommandService != null)
            {
                foreach (var menuCommandHandler in Container.Resolve <IDictionary <SpecFlowCmdSet, MenuCommandHandler> >())
                {
                    menuCommandHandler.Value.RegisterTo(menuCommandService, menuCommandHandler.Key);
                }
            }

            await base.InitializeAsync(cancellationToken, progress);
        }