Example #1
0
        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 JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            if (!(await GetServiceAsync(typeof(DTE)) is DTE2 dte2))
            {
                return;
            }
            _dte2 = dte2;

            // Initialize DependencyResolver
            _dependencyResolver = await GetDependencyResolverAsync();

            _dependencyResolver.RegisterPackage(this);

            // Initialize DTE event handlers
            AttachToDteEvents();

            // Initialize commands
            ScriptCreationWindowCommand.Initialize(_dependencyResolver.Get <ScriptCreationWindowCommand>());
            VersionHistoryWindowCommand.Initialize(_dependencyResolver.Get <VersionHistoryWindowCommand>());
            ConfigurationWindowCommand.Initialize(_dependencyResolver.Get <ConfigurationWindowCommand>());
        }