Ejemplo n.º 1
0
        public static void ChangeLight3()
        {
            if (ModbusProtocol.GetDataCoils(3) == true)
            {
                if (TrainViewModel.queueTrainTo402Track.Count != 0 && ModbusProtocol.avaliableDeparture == 402 && ModbusProtocol.GetInputStatus(69) == true)
                {
                    ChangeLight(3);
                    int        number = TrainViewModel.queueTrainTo402Track.First();
                    View.Train train  = TrainViewModel.trainList[number];
                    TrainViewModel.queueTrainTo402Track.Remove(number);

                    train.storyboard.Resume();
                    train.timer.Start();
                }


                else if (ModbusProtocol.GetInputStatus(69))
                {
                    if (ModbusProtocol.availableTrack2 != 0 && ModbusProtocol.availableTrack == 402)
                    {
                        ChangeLight(3);
                    }
                    else
                    {
                        ViewModel.VisualizationViewModel.ShowMessage("Error");
                        ModbusProtocol.SetDataCoils(3, false);
                        ModbusProtocol.SetInputStatus(68, true);
                    }
                }
                else
                {
                    ViewModel.VisualizationViewModel.ShowMessage("Error");
                    ModbusProtocol.SetDataCoils(3, false);
                    ModbusProtocol.SetInputStatus(68, true);
                }
            }
            else
            {
                ChangeLight(3);
            }
        }
Ejemplo n.º 2
0
 public static void ChangeLight1()
 {
     if (ModbusProtocol.GetInputStatus(69))
     {
         if (ModbusProtocol.availableTrack2 != 0 && ModbusProtocol.availableTrack == 401 || ModbusProtocol.availableTrack == 403 || ModbusProtocol.availableTrack == 405)
         {
             ChangeLight(1);
         }
         else
         {
             ViewModel.VisualizationViewModel.ShowMessage("Error");
             ModbusProtocol.SetDataCoils(1, false);
             ModbusProtocol.SetInputStatus(68, true);
         }
     }
     else
     {
         ViewModel.VisualizationViewModel.ShowMessage("Error");
         ModbusProtocol.SetDataCoils(1, false);
         ModbusProtocol.SetInputStatus(68, true);
     }
 }