Пример #1
0
 private void Controller_PhaseChanged(object sender, PhaseEventArgs args)
 {
     if (sender.ToString() == "N/S")
     {
         NorthTrafficLight.Switch(args);
         SouthTrafficLight.Switch(args);
     }
     else
     {
         EastTrafficLight.Switch(args);
         WestTrafficLight.Switch(args);
     }
 }
Пример #2
0
        public Crossing()
        {
            InitializeComponent();
            MainController = new PhaseController("E/W", MainPhaseQueue);
            SubController  = new PhaseController("N/S", SubPhaseQueue, MainController);

            NorthTrafficLight.Switch(PhaseType.Stop);
            SouthTrafficLight.Switch(PhaseType.Stop);
            EastTrafficLight.Switch(PhaseType.Go);
            WestTrafficLight.Switch(PhaseType.Go);

            MainController.PhaseChanged += Controller_PhaseChanged;
            SubController.PhaseChanged  += Controller_PhaseChanged;
        }