Exemple #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;

                ViewModelHelper.UpdateProjects(_viewModel.SolutionItem, _dte.Solution);
                _viewModel.ProjectsList.Clear();

                if (_viewModel.ControlSettings.GeneralSettings.FillProjectListOnBuildBegin)
                {
                    _viewModel.ProjectsList.AddRange(_viewModel.SolutionItem.AllProjects);
                }

                _viewModel.ResetIndicators(ResetIndicatorMode.ResetValue);

                OnBuildBegin(_buildContext.BuildScope);
            }
            catch (Exception ex)
            {
                ex.TraceUnknownException();
            }
        }
Exemple #2
0
        private void Initialize()
        {
            _buildDistributor.OnBuildBegin        += (s, e) => BuildEvents_OnBuildBegin();
            _buildDistributor.OnBuildDone         += (s, e) => BuildEvents_OnBuildDone();
            _buildDistributor.OnBuildProcess      += (s, e) => BuildEvents_OnBuildProcess();
            _buildDistributor.OnBuildCancelled    += (s, e) => BuildEvents_OnBuildCancelled();
            _buildDistributor.OnBuildProjectBegin += BuildEvents_OnBuildProjectBegin;
            _buildDistributor.OnBuildProjectDone  += BuildEvents_OnBuildProjectDone;
            _buildDistributor.OnErrorRaised       += BuildEvents_OnErrorRaised;

            _solutionEvents.AfterClosing += () =>
            {
                _viewModel.TextCurrentState = Resources.BuildDoneText_BuildNotStarted;

                ControlTemplate stateImage;
                _viewModel.ImageCurrentState       = BuildImages.GetBuildDoneImage(null, null, out stateImage);
                _viewModel.ImageCurrentStateResult = stateImage;

                UpdateSolutionItem();
                _viewModel.ProjectsList.Clear();

                _viewModel.ResetIndicators(ResetIndicatorMode.Disable);

                _viewModel.BuildProgressViewModel.ResetTaskBarInfo();
            };

            _solutionEvents.Opened += () =>
            {
                UpdateSolutionItem();
                _viewModel.ResetIndicators(ResetIndicatorMode.ResetValue);
            };

            UpdateSolutionItem();
        }
Exemple #3
0
        public ControlModel()
        {
            ValueIndicators  = ValueIndicatorsFactory.CreateCollection();
            SolutionItem     = new SolutionItem();
            TextCurrentState = BuildMessages.GetBuildDoneMessage(null, null, null);

            ControlTemplate stateImage;

            ImageCurrentState       = BuildImages.GetBuildDoneImage(null, null, out stateImage);
            ImageCurrentStateResult = stateImage;
        }
Exemple #4
0
        private void BuildEvents_OnBuildDone()
        {
            try
            {
                var settings = _viewModel.ControlSettings;

                if (_buildContext.BuildScope == BuildScopes.BuildScopeSolution)
                {
                    foreach (var projectItem in _viewModel.ProjectsList)
                    {
                        if (projectItem.State == ProjectState.Pending)
                        {
                            projectItem.State = ProjectState.Skipped;
                        }
                    }
                }

                _viewModel.UpdateIndicators(_buildContext);

                var message        = BuildMessages.GetBuildDoneMessage(_viewModel.SolutionItem, _buildContext, settings.BuildMessagesSettings);
                var buildDoneImage = BuildImages.GetBuildDoneImage(_buildContext, _viewModel.ProjectsList, out ControlTemplate stateImage);

                OutputInStatusBar(message, false);
                _viewModel.TextCurrentState        = message;
                _viewModel.ImageCurrentState       = buildDoneImage;
                _viewModel.ImageCurrentStateResult = stateImage;
                _viewModel.CurrentProject          = null;
                _viewModel.OnBuildDone(_buildContext);

                int errorProjectsCount = _viewModel.ProjectsList.Count(item => item.State.IsErrorState());
                if (errorProjectsCount > 0 || _buildContext.BuildIsCancelled)
                {
                    ApplyToolWindowStateAction(settings.WindowSettings.WindowActionOnBuildError);
                }
                else
                {
                    ApplyToolWindowStateAction(settings.WindowSettings.WindowActionOnBuildSuccess);
                }

                bool navigateToBuildFailureReason = (!_buildContext.BuildedProjects.BuildWithoutErrors &&
                                                     settings.GeneralSettings.NavigateToBuildFailureReason == NavigateToBuildFailureReasonCondition.OnBuildDone);
                if (navigateToBuildFailureReason && _buildContext.BuildedProjects.Any(p => p.ErrorsBox.Errors.Any(NavigateToErrorItem)))
                {
                    _buildErrorIsNavigated = true;
                }
            }
            catch (Exception ex)
            {
                ex.TraceUnknownException();
            }
        }