Exemplo 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);
            }
        }
 public static void RemoveTrain(View.Train train)
 {
     visualization.DoRemoveTrain(train);
 }