Exemple #1
0
 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;
         }
     }
 }
Exemple #2
0
 public void DInputChanged(object sender, DiSnapEventArgs e)
 {
 }
Exemple #3
0
 public void instantDiCtrl_Interrupt(object sender, DiSnapEventArgs e)
 {
 }
Exemple #4
0
 static void instantDiCtrl_Interrupt(object sender, DiSnapEventArgs e)
 {
     Console.WriteLine(" DI channel {0} interrupt occurred!", e.SrcNum);
 }