public async Task ItShould_Initialize()
        {
            await ClosedDocumentsHistory.InitializeAsync(_docuemntQueriesMock.Object,
                                                         null,
                                                         null,
                                                         null,
                                                         null,
                                                         null,
                                                         _historyToolWindowRepositoryFactoryMock.Object);

            Assert.NotNull(ClosedDocumentsHistory.ContentWindow);
        }
Ejemplo n.º 2
0
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            try
            {
                Init();

                LoggerContext.Current.Logger.Info($"{nameof(ReopenPackage)} initializing VS commands...");

                await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

                //Init Commands with DI
                await ReopenClosedDocumentsCommand.InitializeAsync(this, _reopenLastClosedCommand);

                await RemoveClosedDocumentsCommand.InitializeAsync(this, _removeLastClosedCommand);

                await ClearDocumentsHistoryCommand.InitializeAsync(this, _clearHistoryCommand);

                await DocumentsHistoryCommand.InitializeAsync(this, _documentHistoryQueries, _reopenSomeDocumentsCommandFactory);

                var imageService = (IVsImageService2)Package.GetGlobalService(typeof(SVsImageService));

                //Init ToolWindow Commands with DI
                await ShowDocumentsHIstoryCommand.InitializeAsync(this);

                await ClosedDocumentsHistory.InitializeAsync(_documentHistoryQueries,
                                                             _reopenLastClosedCommand,
                                                             _reopenSomeDocumentsCommandFactory,
                                                             _removeSomeDocumentsCommandFactory,
                                                             _clearHistoryCommand,
                                                             new CachedFileExtensionIconResolver(
                                                                 new VisualStudioFileExtensionIconResolver(imageService)),
                                                             new JsonIHistoryToolWindowRepositoryFactory(new ServiceStackJsonSerializer()));

                EnforceKeyBinding();

                LoggerContext.Current.Logger.Info($"{nameof(ReopenPackage)} VS commands initialization was successfully finished...");
            }
            catch (Exception ex)
            {
                LoggerContext.Current.Logger.Error($"Failed to Initialize {nameof(ReopenPackage)} VS Extension", ex);
            }
        }