Esempio n. 1
0
        private void BuildEvents_OnBuildBegin()
        {
            try
            {
                _buildErrorIsNavigated = false;

                ApplyToolWindowStateAction(_viewModel.ControlSettings.WindowSettings.WindowActionOnBuildBegin);

                UpdateSolutionItem();

                string message = BuildMessages.GetBuildBeginMajorMessage(
                    _viewModel.SolutionItem,
                    _buildContext,
                    _viewModel.ControlSettings.BuildMessagesSettings);

                OutputInStatusBar(message, true);
                _viewModel.TextCurrentState        = message;
                _origTextCurrentState              = message;
                _viewModel.ImageCurrentState       = BuildImages.GetBuildBeginImage(_buildContext);
                _viewModel.ImageCurrentStateResult = null;

                if (_viewModel.ControlSettings.GeneralSettings.FillProjectListOnBuildBegin)
                {
                    _viewModel.SolutionItem.UpdateProjects();
                }
                else
                {
                    _viewModel.ProjectsList.Clear();
                }

                _viewModel.ResetIndicators(ResetIndicatorMode.ResetValue);

                _viewModel.OnBuildBegin(_buildContext);
            }
            catch (Exception ex)
            {
                ex.TraceUnknownException();
            }
        }
Esempio n. 2
0
        public void OnBuildBegin(BuildScopes?buildScope)
        {
            int projectsCount = -1;

            switch (buildScope)
            {
            case BuildScopes.BuildScopeSolution:
                if (_viewModel.ControlSettings.GeneralSettings.FillProjectListOnBuildBegin)
                {
                    projectsCount = _viewModel.ProjectsList.Count;
                }
                else
                {
                    try
                    {
                        Solution solution = _dte.Solution;
                        if (solution != null)
                        {
                            projectsCount = solution.GetProjects().Count;
                        }
                    }
                    catch (Exception ex)
                    {
                        ex.Trace("Unable to count projects in solution.");
                    }
                }
                break;

            case BuildScopes.BuildScopeBatch:
            case BuildScopes.BuildScopeProject:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(buildScope));
            }

            _viewModel.OnBuildBegin(projectsCount, _buildContext);
        }