public ChangeGreenYellow(MainWindow mn, ChangeLight chgLight)
 {
     Thrd = new Thread(this.Run);
     Thrd.Name = "GYThread";
     main = mn;
     light = chgLight;
 }
        public void ChangeIt(MainWindow cntrl)
        {
            lock (obj)
            {
                //Console.WriteLine(Thread.CurrentThread.Name);

                //Dispatcher disp;
                //object[] objs = { el };
                if (Thread.CurrentThread.Name == "RYThread" || Thread.CurrentThread.Name == "GYThread")
                    //Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, cntrl.myDelegateYellow);
                    cntrl.Dispatcher.Invoke(DispatcherPriority.Normal, cntrl.myDelegateYellow);
                if (Thread.CurrentThread.Name == "YRThread")
                    //Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, cntrl.myDelegateRed);
                    cntrl.Dispatcher.Invoke(DispatcherPriority.Normal, cntrl.myDelegateRed);
                if (Thread.CurrentThread.Name == "YGThread")
                    //Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, cntrl.myDelegateGreen);
                    cntrl.Dispatcher.Invoke(DispatcherPriority.Normal, cntrl.myDelegateGreen);
                //disp.Invoke(cntrl.myDelegate, el);
                //cntrl.Invoke(cntrl.myDelegate);

                //Console.WriteLine(el.Name);
                Thread.Sleep(1000);
                //Thread.CurrentThread.Join(1000);
            }
        }
 public ChangeGreenYellow(MainWindow mn)
 {
     Thrd = new Thread(this.Run);
     Thrd.Name = "GYThread";
     main = mn;
     //ellipse = el;
     changeLight = new ChangeLight();
 }
 //static ChangeLight chgLight = new ChangeLight();
 public ChangeGreenYellow(MainWindow mn)
 {
     Thrd = new Thread(this.Run);
     Thrd.Name = "GYThread";
     main = mn;
     light = new ChangeLight();
     //Thrd.Start();
 }
 public void ChangeGY(Ellipse el, MainWindow cntrl)
 {
     lock (obj)
     {
         cntrl.Dispatcher.Invoke(DispatcherPriority.Normal, cntrl.myDelegate, el);
         Thread.Sleep(1000);
         Monitor.Pulse(obj);
         Monitor.Wait(obj);
     }
 }
 public void ChangeIt(Ellipse el, MainWindow cntrl)
 {
     lock (obj)
     {
         object[] objs = { el };
         if(precessing)
             cntrl.Dispatcher.Invoke(cntrl.myDelegate, objs);
         Thread.Sleep(1000);
     }
 }
 public void Change(Ellipse el, MainWindow cntrl)
 {
     cntrl.Dispatcher.Invoke(DispatcherPriority.Normal, cntrl.myDelegate, el);
     Thread.Sleep(1000);
 }
 public ChangeYellowRed(MainWindow mn, ChangeLight chgLight)
 {
     Thrd = new Thread(this.Run);
     Thrd.Name = "YRThread";
     main = mn;
     light = chgLight;
     //Thrd.Start();
 }
 public ChangeYellowRed(MainWindow mn)
 {
     Thrd = new Thread(this.Run);
     Thrd.Name = "YRThread";
     main = mn;
     changeLight = new ChangeLight();
     //ellipse = el;
 }