示例#1
0
        private void Init()
        {
            _dte = GetGlobalService(typeof(DTE)) as DTE2 ?? throw new NullReferenceException($"Unable to get service {nameof(DTE2)}");

            //Log context and Serilog enricher
            VsVersionContext.Current = new VsDteVersionContext(_dte);
            LoggerContext.Current    = new LogentriesSerilogLoggerContext();

            LoggerContext.Current.Logger.Info($"{nameof(ReopenPackage)} started to load. Initializing dependencies...");

            //DI
            IDocumentHistoryManager documentHistory = new DocumentHistoryManager();

            _documentHistoryCommands = documentHistory;
            _documentHistoryQueries  = documentHistory;

            //Commands
            _reopenLastClosedCommand = new RemoveLastCommand(_documentHistoryCommands,
                                                             new ReopenDocumentCommandFactory(_dte));
            _removeLastClosedCommand = new RemoveLastCommand(_documentHistoryCommands,
                                                             new DoNothingDocumentCommandFactory());
            _reopenSomeDocumentsCommandFactory = new HistoryCommandFactory <RemoveSomeCommand>(_documentHistoryCommands,
                                                                                               new ReopenDocumentCommandFactory(_dte));
            _removeSomeDocumentsCommandFactory = new HistoryCommandFactory <RemoveSomeCommand>(_documentHistoryCommands,
                                                                                               new DoNothingDocumentCommandFactory());
            _clearHistoryCommand = new ClearHistoryCommand(_documentHistoryCommands);

            _documentTracker = new DocumentEventsTracker(_dte,
                                                         documentHistory,
                                                         new JsonHistoryRepositoryFactory(new ServiceStackJsonSerializer()),
                                                         new VSMessageBox(this));
        }
示例#2
0
 public RemoveSomeCommand(IDocumentHistoryCommands documentHistoryCommands,
                          IDocumentCommandFactory documentCommandFactory,
                          params IClosedDocument[] closedDocuments)
 {
     _documentHistoryCommands = documentHistoryCommands;
     _documentCommandFactory  = documentCommandFactory;
     _closedDocuments         = closedDocuments;
 }
 public FakeCommand2(IDocumentHistoryCommands documentHistoryCommands,
                     IDocumentCommandFactory documentCommandFactory,
                     params IClosedDocument[] closedDocuments)
 {
     DocumentHistoryCommands = documentHistoryCommands;
     DocumentCommandFactory  = documentCommandFactory;
     ClosedDocuments         = closedDocuments;
 }
 public HistoryCommandFactory(IDocumentHistoryCommands documentHistoryCommands,
                              IDocumentCommandFactory documentCommandFactory)
 {
     _documentHistoryCommands = documentHistoryCommands;
     _documentCommandFactory  = documentCommandFactory;
 }
示例#5
0
 public ClearHistoryCommand(IDocumentHistoryCommands documentHistoryCommands)
 {
     _documentHistoryCommands = documentHistoryCommands;
 }
示例#6
0
 public RemoveLastCommand(IDocumentHistoryCommands documentHistoryCommands,
                          IDocumentCommandFactory documentCommandFactory)
 {
     _documentHistoryCommands = documentHistoryCommands;
     _documentCommandFactory  = documentCommandFactory;
 }