public void Notify(CMonData data) { //Log.WriteCMonData(data); for (int i = 0; i < data.GetSignals(Shared.SignalType.CHE).Length; i++) { if (data.GetSignal(Shared.SignalType.CHE, i) == 1) { picBoxChe[i].BackColor = Color.Green; } else { picBoxChe[i].BackColor = Color.Red; } } for (int i = 0; i < data.GetSignals(Shared.SignalType.GAN).Length; i++) { if (data.GetSignal(Shared.SignalType.GAN, i) == 1) { picBoxGan[i].BackColor = Color.Green; } else { picBoxGan[i].BackColor = Color.Red; } } for (int i = 0; i < data.GetSignals(Shared.SignalType.XIAN).Length; i++) { if (data.GetSignal(Shared.SignalType.XIAN, i) == 1) { picBoxXian[i].BackColor = Color.Green; } else { picBoxXian[i].BackColor = Color.Red; } } }
private bool alarm;//报警标志,在timer中控制报警 #region IMonObserver Members public void Notify(CMonData data) { //Log.WriteCMonData(data); if (IsStartTest) { alarm = false; if (IsSignalGanXian) { //车 if (IsSignalCar) { for (int i = 0; i < data.GetSignals(Shared.SignalType.CHE).Length; i++) { if (data.GetSignal(Shared.SignalType.CHE, i) == 1) { picBoxChe[i].BackColor = Color.Green; } else { picBoxChe[i].BackColor = Color.Red; } } } //杆 if (IsSiganlGan) { for (int i = 0; i < data.GetSignals(Shared.SignalType.GAN).Length; i++) { if (i == gxNumber - 1) { if (data.GetSignal(Shared.SignalType.GAN, i) == 1) { picBoxGan[i].BackColor = Color.Green; } else { picBoxGan[i].BackColor = Color.Red; if (i < 5) { alarm = true; } } } } } //线 if (IsSignalXian) { for (int i = 0; i < data.GetSignals(Shared.SignalType.XIAN).Length; i++) { if (i == gxNumber - 1) { if (data.GetSignal(Shared.SignalType.XIAN, i) == 1) { picBoxXian[i].BackColor = Color.Green; } else { picBoxXian[i].BackColor = Color.Red; if (i < 5) { alarm = true; } } } } } } else { //车 for (int i = 0; i < data.GetSignals(Shared.SignalType.CHE).Length; i++) { if (data.GetSignal(Shared.SignalType.CHE, i) == 1) { picBoxChe[i].BackColor = Color.Green; } else { picBoxChe[i].BackColor = Color.Red; } } //杆 for (int i = 0; i < data.GetSignals(Shared.SignalType.GAN).Length; i++) { if (data.GetSignal(Shared.SignalType.GAN, i) == 1) { picBoxGan[i].BackColor = Color.Green; } else { picBoxGan[i].BackColor = Color.Red; if (i < 5) { alarm = true; } } } //线 for (int i = 0; i < data.GetSignals(Shared.SignalType.XIAN).Length; i++) { if (data.GetSignal(Shared.SignalType.XIAN, i) == 1) { picBoxXian[i].BackColor = Color.Green; } else { picBoxXian[i].BackColor = Color.Red; if (i < 5) { alarm = true; } } } } } }