public void InitVm(Parameters parameters) { BarsBackground.Clear(); BarsContur.Clear(); BarsContent.Clear(); BarsValue.Clear(); RuleDatas.Clear(); RuleInscriptions.Clear(); BarsName.Clear(); BarsFrame.Clear(); BindingLine.Clear(); _parameters = parameters; _greenZoneRabCyl1 = _mineConfig.BrakeSystemConfig.GreenZoneRabCyl1.Value; _greenZoneRabCyl2 = _mineConfig.BrakeSystemConfig.GreenZoneRabCyl2.Value; _greenZonePredCyl1 = _mineConfig.BrakeSystemConfig.GreenZonePredCyl1.Value; _greenZonePredCyl2 = _mineConfig.BrakeSystemConfig.GreenZonePredCyl2.Value; _rabCyl1Pressure = (_parameters.BrakeRabCyl1Pressure - _mineConfig.BrakeSystemConfig.AdcZero.Value) * _mineConfig.BrakeSystemConfig.AdcValueToBarrKoef.Value; _rabCyl2Pressure = (_parameters.BrakeRabCyl2Pressure - _mineConfig.BrakeSystemConfig.AdcZero.Value) * _mineConfig.BrakeSystemConfig.AdcValueToBarrKoef.Value; _predCyl1Pressure = (_parameters.BrakePredCyl1Pressure - _mineConfig.BrakeSystemConfig.AdcZero.Value) * _mineConfig.BrakeSystemConfig.AdcValueToBarrKoef.Value; _predCyl2Pressure = (_parameters.BrakePredCyl2Pressure - _mineConfig.BrakeSystemConfig.AdcZero.Value) * _mineConfig.BrakeSystemConfig.AdcValueToBarrKoef.Value; }
public List <FillRectData> GetBarsBackgroundDatas() { //RabCyl1 int x = _x - 70; int y = _y + _height + _height + _height / 2; int width = _barWidth; int height = _barHight; int color = 170; Color col; BarsBackground.Add(new FillRectData { LeftTopX = x, LeftTopY = y, Height = height, Width = width, Brush = new SolidBrush(Color.FromArgb(255, color, color, color)) }); color = 150; BarsContur.Add(new RectData { LeftTopX = x - 1, LeftTopY = y - 1, Height = height + 2, Width = width + 2, Pen = new Pen(Color.FromArgb(255, color, color, color), 2) }); width = Convert.ToInt32((_barWidth / _maxPressure) * _rabCyl1Pressure); if (_rabCyl1Pressure < _greenZoneRabCyl1 || _parameters.BrakeRabCyl1Pressure > _rabCyl1Pressure) { col = Color.IndianRed; } else { col = Color.Green; } BarsContent.Add(new FillRectData { LeftTopX = x, LeftTopY = y, Height = height, Width = width, Brush = new SolidBrush(col) }); BarsValue.Add(new TextData { LeftTopX = x + _barWidth / 2 - 15, LeftTopY = y, Text = Convert.ToString(Math.Round(_rabCyl1Pressure, 2), CultureInfo.GetCultureInfo("en-US")) }); //PredCyl1 x = _x - 70; y = _y + _height + _height + _height / 2 - (_barHight + 75); width = _barWidth; height = _barHight; color = 170; BarsBackground.Add(new FillRectData { LeftTopX = x, LeftTopY = y, Height = height, Width = width, Brush = new SolidBrush(Color.FromArgb(255, color, color, color)) }); color = 150; BarsContur.Add(new RectData { LeftTopX = x - 1, LeftTopY = y - 1, Height = height + 2, Width = width + 2, Pen = new Pen(Color.FromArgb(255, color, color, color), 2) }); width = Convert.ToInt32((_barWidth / _maxPressure) * _predCyl1Pressure); if (_predCyl1Pressure < _greenZonePredCyl1 || _predCyl1Pressure > _greenZonePredCyl2) { col = Color.IndianRed; } else { col = Color.Green; } BarsContent.Add(new FillRectData { LeftTopX = x, LeftTopY = y, Height = height, Width = width, Brush = new SolidBrush(col) }); BarsValue.Add(new TextData { LeftTopX = x + _barWidth / 2 - 15, LeftTopY = y, Text = Convert.ToString(Math.Round(_predCyl1Pressure, 2), CultureInfo.GetCultureInfo("en-US")) }); //RabCyl2 x = _x - 70 + _barWidth + 50; y = _y + _height + _height + _height / 2; width = _barWidth; height = _barHight; color = 170; BarsBackground.Add(new FillRectData { LeftTopX = x, LeftTopY = y, Height = height, Width = width, Brush = new SolidBrush(Color.FromArgb(255, color, color, color)) }); color = 150; BarsContur.Add(new RectData { LeftTopX = x - 1, LeftTopY = y - 1, Height = height + 2, Width = width + 2, Pen = new Pen(Color.FromArgb(255, color, color, color), 2) }); width = Convert.ToInt32((_barWidth / _maxPressure) * _rabCyl2Pressure); if (_rabCyl2Pressure < _greenZoneRabCyl1 || _rabCyl2Pressure > _greenZoneRabCyl2) { col = Color.IndianRed; } else { col = Color.Green; } BarsContent.Add(new FillRectData { LeftTopX = x, LeftTopY = y, Height = height, Width = width, Brush = new SolidBrush(col) }); BarsValue.Add(new TextData { LeftTopX = x + _barWidth / 2 - 15, LeftTopY = y, Text = Convert.ToString(Math.Round(_rabCyl2Pressure, 2), CultureInfo.GetCultureInfo("en-US")) }); //PredCyl2 x = _x - 70 + _barWidth + 50; y = _y + _height + _height + _height / 2 - (_barHight + 75); width = _barWidth; height = _barHight; color = 170; BarsBackground.Add(new FillRectData { LeftTopX = x, LeftTopY = y, Height = height, Width = width, Brush = new SolidBrush(Color.FromArgb(255, color, color, color)) }); color = 150; BarsContur.Add(new RectData { LeftTopX = x - 1, LeftTopY = y - 1, Height = height + 2, Width = width + 2, Pen = new Pen(Color.FromArgb(255, color, color, color), 2) }); width = Convert.ToInt32((_barWidth / _maxPressure) * _predCyl2Pressure); if (_predCyl2Pressure < _greenZonePredCyl1 || _predCyl2Pressure > _greenZonePredCyl2) { col = Color.IndianRed; } else { col = Color.Green; } BarsContent.Add(new FillRectData { LeftTopX = x, LeftTopY = y, Height = height, Width = width, Brush = new SolidBrush(col) }); BarsValue.Add(new TextData { LeftTopX = x + _barWidth / 2 - 15, LeftTopY = y, Text = Convert.ToString(Math.Round(_predCyl2Pressure, 2), CultureInfo.GetCultureInfo("en-US")) }); return(BarsBackground); }