ControlData IViewControlHandler.GetCurrentData()
        {
            var state = postprocessorsManager.GetCorrelatorStateSummary();

            if (state.Status == CorrelatorStateSummary.StatusCode.PostprocessingUnavailable)
            {
                return(new ControlData()
                {
                    Disabled = true,
                    Content = "Fix clock skew: N/A"
                });
            }

            var ret = new ControlData();

            ret.Disabled = false;

            switch (state.Status)
            {
            case CorrelatorStateSummary.StatusCode.NeedsProcessing:
                ret.Content = string.Format("Logs clocks may be{0}out of sync.{0}*2 Fix clock skew*", Environment.NewLine);
                ret.Color   = ControlData.StatusColor.Warning;
                break;

            case CorrelatorStateSummary.StatusCode.ProcessingInProgress:
                ret.Content  = "Fixing clock skew...";
                ret.Progress = state.Progress;
                break;

            case CorrelatorStateSummary.StatusCode.Processed:
            case CorrelatorStateSummary.StatusCode.ProcessingFailed:
                bool wasSuccessful = state.Status == CorrelatorStateSummary.StatusCode.Processed;
                ret.Content = (wasSuccessful ? "Clock skew is fixed." : "Failed to fix clock skew.") + Environment.NewLine;
                if (state.Report != null)
                {
                    ret.Content += "*1 View report.* ";
                }
                ret.Content += wasSuccessful ? "*2 Fix again*" : "*2 Try again*";
                if (!wasSuccessful)
                {
                    ret.Color = ControlData.StatusColor.Error;
                }
                else
                {
                    ret.Color = ControlData.StatusColor.Success;
                }
                break;
            }

            return(ret);
        }
Beispiel #2
0
        void Update()
        {
            bool wasActive = IsActiveImpl();

            lastSummary = ppm.GetCorrelatorStateSummary();
            if (Changed != null)
            {
                Changed(this, new ItemChangeEventArgs(isUnsuppressingChange: IsActiveImpl() && !wasActive));
            }
        }