public void Notify(CMonData data) { CSignals g = data.GetSignals(SignalType.GAN); for (int i = 0; i < 5; i++) { gan[i].Stat = g[i]; } CSignals x = data.GetSignals(SignalType.XIAN); for (int i = 0; i < 5; i++) { xian[i].Stat = x[i]; } }
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 checkSignals() { CMonData tempData = monitor.CurrData; SignLength sigLen = monitor.SignalLength; CSignals ganSig = tempData.GetSignals(SignalType.GAN); for (int i = 0; i < sigLen.GAN_LENGTH; i++) { if (ganSig[i] == 0) { return(false); } } CSignals xianSig = tempData.GetSignals(SignalType.XIAN); for (int i = 0; i < sigLen.XIAN_LENGTH; i++) { if (xianSig[i] == 0) { return(false); } } return(true); }
public void Notify(Exam.Exam exam) { if (!exam.Passed) { //若要改变出错时模型车位置,请调整此处代码。 //可再为每种ResultType添加switch(exam.Message.Index), //以细化针对不同杆线错误时,模型车的位置 switch (exam.Message.TypeOfResult) { case ResultType.Gan: che.SetWeizhi(gan[exam.Message.Index].X, gan[exam.Message.Index].Y); break; case ResultType.Xian: switch (exam.Message.Index) { case 0: case 2: che.SetWeizhi(xian[exam.Message.Index].X1, che.Y); break; case 1: case 3: case 4: che.SetWeizhi(che.X, xian[exam.Message.Index].Y1); break; } break; case ResultType.ZT: che.SetWeizhi(che.X, che.Y); break; case ResultType.XH: che.SetWeizhi(che.X, che.Y); break; case ResultType.LXC: che.SetWeizhi(che.X, che.Y); break; case ResultType.TimeOut: che.SetWeizhi(che.X, che.Y); break; default: break; } } CMonData data = monitor.CurrData; CSignals g = data.GetSignals(SignalType.GAN); for (int i = 0; i < 5; i++) { gan[i].Stat = g[i]; } CSignals x = data.GetSignals(SignalType.XIAN); for (int i = 0; i < 5; i++) { xian[i].Stat = x[i]; } if (this.picBoxModelBackGround.InvokeRequired) { NotifyDelegate doNotify = new NotifyDelegate(DoNotify); this.picBoxModelBackGround.Invoke(doNotify); } else { DoNotify(); } }
public override void Notify(CMonData data) { if (monitor.Ready) { CSignals oldx = oldData.GetSignals(SignalType.XIAN); for (int i = 0; i < monitor.SignalLength.XIAN_LENGTH; i++) { CSignals sig = data.GetSignals(SignalType.XIAN); if (sig[i] != oldx[i]) { SignalEvent handler; if (sig[i] == 1) { handler = LeaveXianEvent; } else { handler = BlockXianEvent; } handler(this, new SignalEventArgs(SignalType.XIAN, i)); } } CSignals oldg = oldData.GetSignals(SignalType.GAN); for (int i = 0; i < monitor.SignalLength.GAN_LENGTH; i++) { CSignals sig = data.GetSignals(SignalType.GAN); if (sig[i] != oldg[i]) { SignalEvent handler; if (sig[i] == 0) { handler = HitGanEvent; } else { handler = ResetGanEvent; } handler(this, new SignalEventArgs(SignalType.GAN, i)); } } CSignals oldc = oldData.GetSignals(SignalType.CHE); for (int i = 0; i < monitor.SignalLength.CHE_LENGTH; i++) { CSignals sig = data.GetSignals(SignalType.CHE); if (sig[i] != sig[i]) { if (sig[i] == 1) { EventHandler handler = CarStopEvent; switch (i) { case 0: handler = CarMoveForwardEvent; break; case 1: handler = CarMoveBackEvent; break; case 2: handler = CarStopEvent; break; case 3: handler = CarFlameoutEvent; break; } handler(this, new EventArgs()); } } } } else { monitor.Ready = true; } oldData.Copy(data); }
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; } } } } } }