Пример #1
0
        private void OnSolutionEventsOnOpened()
        {
            _documentEvents.DocumentClosing += DocumentEventsOnDocumentClosing;
            SolutionState = SolutionStates.Opened;

            string slnPath = _dte.Solution.FullName;             //can be empty if it is a new solution??

            LoggerContext.Current.Logger.Info($"{nameof(DocumentEventsTracker)}.{nameof(OnSolutionEventsOnOpened)}() method executing. Opened solution Full path: '{slnPath}'");

            if (string.IsNullOrWhiteSpace(slnPath))
            {
                slnPath = _dte.Solution.Properties.Item("Path")?.Value?.ToString();                 //https://github.com/3F/vsCommandEvent/blob/master/vsCommandEvent/Environment.cs
                LoggerContext.Current.Logger.Warning($"{nameof(DocumentEventsTracker)}.{nameof(OnSolutionEventsOnOpened)}() method executing. _dte.Solution.FullName was EMPTY or NULL. Getting Solution.Properties Full path: '{slnPath}'");
            }

            var solutionDir  = Path.GetDirectoryName(slnPath);
            var solutionName = Path.GetFileName(slnPath).Replace(".sln", string.Empty);

            _currentSolution = new SolutionInfo(solutionDir, solutionName);

            //Create history repo
            var historyRepository = _historyRepositoryFactory.CreateHistoryRepository(_currentSolution);

            //Load history and init state
            var history = historyRepository?.GetHistory();

            _documentHistoryManager.Initialize(history);
        }
Пример #2
0
        private void OnSolutionEventsOnOpened()
        {
            _documentEvents.DocumentClosing += DocumentEventsOnDocumentClosing;
            SolutionState = SolutionStates.Opened;

            var solutionDir  = Path.GetDirectoryName(_dte.Solution.FullName);
            var solutionName = Path.GetFileName(_dte.Solution.FullName).Replace(".sln", string.Empty);

            _currentSolution = new SolutionInfo(solutionDir, solutionName);

            //Create history repo
            var historyRepository = _historyRepositoryFactory.CreateHistoryRepository(_currentSolution);

            //Load history and init state
            var history = historyRepository?.GetHistory();

            _documentHistoryManager.Initialize(history);
        }