Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> History(
            [FromHeader] Guid personUniqueId,
            [FromQuery] string documentUniqueId,
            [FromServices] DocumentHistoryManager manager)
        {
            var history = await manager.GetHistoryAsync(User.Identity.Name, personUniqueId, documentUniqueId);

            return(Json(ApiResponse.Success(history)));
        }
 public FileAttachmentController(Provider provider, DocumentHistoryManager historyManager)
 {
     _provider       = provider;
     _historyManager = historyManager;
 }
 public DocumentHistoryManagerTest()
 {
     _documentHistoryManager = new DocumentHistoryManager();
     _historyChanged         = false;
     _documentHistoryManager.HistoryChanged += _documentHistoryManager_HistoryChanged;
 }