private void TriggerMagneticSteelEvent(object sender, DiSnapEventArgs e) { if (this.startChannle == e.SrcNum) { hasStartSignal = true; if (!hasEndSignal) { this.timingSW.Restart(); this.signalTimeoutTimer.Start(); } } else if (this.endChannle == e.SrcNum) { hasEndSignal = true; if (hasStartSignal) { this.timingSW.Stop(); this.signalTimeoutTimer.Stop(); float velocity = this.spacing / this.timingSW.ElapsedMilliseconds / 1000; if (this.magneticSteelEnd == MagneticSteelEnd.Far) { this.unitMediator.FarEndGoTrain(this.deviceEnd, velocity); } else { this.unitMediator.NearEndGoTrain(this.deviceEnd, velocity); } hasStartSignal = false; hasEndSignal = false; } else if (hasEndSignal) { if (this.magneticSteelEnd == MagneticSteelEnd.Far) { this.unitMediator.FarEndGoTrain(this.deviceEnd, 0); } else { this.unitMediator.NearEndGoTrain(this.deviceEnd, 0); } hasEndSignal = false; } } }
public void DInputChanged(object sender, DiSnapEventArgs e) { }
public void instantDiCtrl_Interrupt(object sender, DiSnapEventArgs e) { }
static void instantDiCtrl_Interrupt(object sender, DiSnapEventArgs e) { Console.WriteLine(" DI channel {0} interrupt occurred!", e.SrcNum); }