public void UpdateBuildStatus(BuildEventState jobResult)
        {
            eBuildStatus newBuildStatus = _buildStatus;

            switch (jobResult)
            {
                case BuildEventState.FAILED:
                    newBuildStatus = eBuildStatus.HasErrors;
                    break;

                case BuildEventState.TIMEOUT:
                case BuildEventState.SUCCEEDED_COMPLETED_WITH_WARNINGS:
                    if ((int)_buildStatus < (int)eBuildStatus.HasWarnings)
                    {
                        newBuildStatus = eBuildStatus.HasWarnings;
                    }
                    break;
            }

            if (_buildStatus != newBuildStatus)
            {
                switch (newBuildStatus)
                {
                    case eBuildStatus.HasErrors:
                        StatusBarProgressBar.Foreground = Brushes.Red;
                        break;
                    case eBuildStatus.HasWarnings:
                        StatusBarProgressBar.Foreground = Brushes.Yellow;
                        break;
                }

                _buildStatus = newBuildStatus;
            }
        }
            public void Stop(Int64 timeFinished, BuildEventState jobResult)
            {
                _timeFinished = timeFinished;

                double totalTimeSeconds = (_timeFinished - _timeStarted) / 1000.0f;

                // uncomment to catch negative times
                Debug.Assert(totalTimeSeconds >= 0.0f);

                //if (totalTimeSeconds <=0.0f)
                //{
                //    totalTimeSeconds = 0.001f;
                //}

                _toolTipText = string.Format("{0}", _name.Replace("\"", "")) + "\nStatus: ";

                _state = jobResult;

                switch (_state)
                {
                    case BuildEventState.SUCCEEDED_COMPLETED:
                        if (_name.Contains(".obj"))
                        {
                            _brush = _sSuccessCodeBrush;
                        }
                        else
                        {
                            _brush = _sSuccessNonCodeBrush;
                        }
                        _toolTipText += "Success";

                        break;
                    case BuildEventState.SUCCEEDED_CACHED:
                        _brush = _sSuccessCachedBrush;

                        _toolTipText += "Success(Cached)";

                        break;

                    case BuildEventState.SUCCEEDED_PREPROCESSED:
                        _brush = _sSuccessPreprocessedBrush;

                        _toolTipText += "Success(Preprocess)";

                        break;
                    case BuildEventState.FAILED:

                        _brush = _sFailedBrush;
                        _toolTipText += "Errors";

                        break;
                    case BuildEventState.TIMEOUT:

                        _brush = _sTimeoutBrush;
                        _toolTipText += "Timeout";

                        break;
                    default:
                        break;
                }

                _toolTipText += "\nDuration: " + GetTimeFormattedString(_timeFinished - _timeStarted);
                _toolTipText += "\nStart Time: " + GetTimeFormattedString(_timeStarted);
                _toolTipText += "\nEnd Time: " + GetTimeFormattedString(_timeFinished);

                if (null != _outputMessages && _outputMessages.Length > 0)
                {
                    // show only an extract of the errors so we don't flood the visual
                    int textLength = Math.Min(_outputMessages.Length, 100);

                    _toolTipText += "\n" + _outputMessages.Substring(0, textLength);
                    _toolTipText += "... [Double-Click on the event to see more details]";

                    _outputMessages = string.Format("[Output {0}]: {1}", _name.Replace("\"", ""), Environment.NewLine) + _outputMessages;

                    _StaticWindow.AddOutputWindowFilterItem(this);
                }
            }
 public void OnCompleteEvent(Int64 timeCompleted, string eventName, BuildEventState jobResult, string outputMessages)
 {
     for (int i = 0; i < _cores.Count; ++i)
     {
         if (_cores[i].UnScheduleEvent(timeCompleted, eventName, jobResult, outputMessages))
         {
             break;
         }
     }
 }
            public BuildEvent(string name, Int64 timeStarted)
            {
                // Lazy initialize static resources
                if (!_sbInitialized)
                {
                    StaticInitialize();
                }

                _name = name;

                _toolTipText = _name.Replace("\"", "");

                _fileName = System.IO.Path.GetFileName(_name.Replace("\"", ""));

                _timeStarted = timeStarted;

                _state = BuildEventState.IN_PROGRESS;
            }
            public bool UnScheduleEvent(Int64 timeCompleted, string eventName, BuildEventState jobResult, string outputMessages, bool bForce = false)
            {
                bool bOK = (_activeEvent != null && (_activeEvent._name == eventName || bForce));

                if (bOK)
                {
                    if (!bForce && outputMessages.Length > 0)
                    {
                        _activeEvent.SetOutputMessages(outputMessages);
                    }

                    _activeEvent.Stop(timeCompleted, jobResult);

                    _completedEvents.Add(_activeEvent);

                    _activeEvent = null;
                }

                return bOK;
            }