// TODO
        // Implement the missing parts of the presenter
        public void ChangeStation(string stationId)
        {
            foreach (Measurement measurement in iceCreamMonitor.GetMeasurements())
            {
                if (measurement.StationId.Equals(stationId))
                {
                    view.SetStation(stationId);
                    view.SetDate(measurement.Date);
                    view.SetActual(measurement.Actual.ToString());
                    VarianceRange varianceRange = VarianceRange.normal;

                    view.SetVarianceColor(Color.FromRgb(200, 0, 0));
                    view.SetVariance(iceCreamMonitor.CalculateVariance(measurement.Actual, out varianceRange).ToString());
                }
            }
        }
Ejemplo n.º 2
0
        public void ActualChanged(string tbxActualText)
        {
            int actualValue   = int.Parse(tbxActualText);
            var varianceRange = VarianceRange.normal;

            string variance = iceCreamMonitor.CalculateVariance(actualValue, out varianceRange).ToString();

            view.SetActual(tbxActualText);
            view.SetVariance(variance);

            if (int.Parse(variance) < 0)
            {
                view.SetVarianceColor(Colors.Red);
            }
            else
            {
                view.SetVarianceColor(Colors.Aquamarine);
            }
        }
Ejemplo n.º 3
0
        public void NewMeasurement(string stationId, DateTime date, string acText)
        {
            VarianceRange range;

            iceCreamMonitor.AddMeasurement(stationId, date, int.Parse(acText));
            view.SetVariance(iceCreamMonitor.CalculateVariance(int.Parse(acText), out range).ToString());
            switch (range)
            {
            case VarianceRange.low:
                view.SetVarianceColor(Color.FromRgb(255, 0, 0));
                break;

            case VarianceRange.high:
                view.SetVarianceColor(Color.FromRgb(0, 255, 0));
                break;

            case VarianceRange.normal:
            default:
                view.SetVarianceColor(Color.FromRgb(0, 0, 255));
                break;
            }
        }