public void SignalChanged(object sender, string eventData, RailwayCrossingLogger railwayCrossingLogger)
 {
     /*Console.WriteLine("Signal Changed.");*/
     if (eventData == RailwayCrossingTest.INCONMMING)
     {
         this.stop();
     }
     else
     {
         this.Start();
         railwayCrossingLogger.AddDetailsToLogger(this);
         this._signal.SignalChanged -= SignalChanged;
     }
 }
        public static void Main(string[] args)
        {
            const string          TRAIN_1               = "train#1";
            const string          TRAIN_2               = "train#2";
            TrainSignal           railwayCrossing1      = new TrainSignal("Crossing#1");
            TrainSignal           railwayCrossing2      = new TrainSignal("Crossing#2");
            Car                   car1                  = new Car(railwayCrossing1, "car1");
            Car                   car2                  = new Car(railwayCrossing1, "car2");
            Car                   car3                  = new Car(railwayCrossing2, "car3");
            RailwayCrossingLogger railwayCrossingLogger = RailwayCrossingLogger.Instance;

            //Incomming Train1 at crossing#1
            railwayCrossing1.OnSignalChanged(INCONMMING, TRAIN_1, railwayCrossingLogger);
            Thread.Sleep(1000);
            //Incomming Train2 at crossing#2
            railwayCrossing2.OnSignalChanged(INCONMMING, TRAIN_2, railwayCrossingLogger);
            Thread.Sleep(3000);
            //Train2 Crossed crossing#2 Clear
            railwayCrossing2.OnSignalChanged(Track_Clear, TRAIN_2, railwayCrossingLogger);
            Thread.Sleep(1000);
            //Train1 Crossed crossing#1 Clear
            railwayCrossing1.OnSignalChanged(Track_Clear, TRAIN_1, railwayCrossingLogger);



            railwayCrossing2.OnSignalChanged(INCONMMING, TRAIN_1, railwayCrossingLogger);
            railwayCrossing2.OnSignalChanged(Track_Clear, TRAIN_1, railwayCrossingLogger);
            car3.Signal = railwayCrossing1;

            Thread.Sleep(1000);
            railwayCrossing1.OnSignalChanged(INCONMMING, TRAIN_2, railwayCrossingLogger);
            Thread.Sleep(3000);
            //Train2 Crossed crossing#1 Clear
            railwayCrossing1.OnSignalChanged(Track_Clear, TRAIN_2, railwayCrossingLogger);

            railwayCrossingLogger.PrintLoggerDetails();
        }
 internal virtual void OnSignalChanged(string eventDetails, string train, RailwayCrossingLogger railwayCrossingLogger)
 {
     Console.WriteLine("{0}({1}-{2})", eventDetails, this.Name, train);
     SignalChanged?.Invoke(this, eventDetails, railwayCrossingLogger);
 }