Esempio n. 1
0
        public MainWindow()
        {
            InitializeComponent();
            def = Green.Fill;

            RY = new ChangeRedYellow(this);
            YG = new ChangeYellowGreen(this);
            GY = new ChangeGreenYellow(this);
            YR = new ChangeYellowRed(this);

            myDelegate = new ChangeColor(ChangeColorMethod);
        }
        public MainWindow()
        {
            InitializeComponent();
            def = Green.Fill;

            RY = new ChangeRedYellow(this);
            YG = new ChangeYellowGreen(this);
            GY = new ChangeGreenYellow(this);
            YR = new ChangeYellowRed(this);

            myDelegateYellow = new ChangeColor(ChangeToYellowMethod);
            myDelegateRed    = new ChangeColor(ChangeToRedMethod);
            myDelegateGreen  = new ChangeColor(ChangeToGreenMethod);
            //Control f = this;
        }
Esempio n. 3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (ProcessUnstarted())
            {
                ChangeLight.precessing = true;

                //Console.WriteLine("start");
                RY.Thrd.Start(Yellow);
                //RY.Thrd.Join();
                Thread.Sleep(10);
                YG.Thrd.Start(Green);
                Thread.Sleep(10);
                GY.Thrd.Start(Yellow);
                Thread.Sleep(10);
                YR.Thrd.Start(Red);
            }
            else
            {
                if (!ProcessRunning())
                {
                    ChangeLight.precessing = true;

                    RY.Thrd.Abort();
                    YG.Thrd.Abort();
                    GY.Thrd.Abort();
                    YR.Thrd.Abort();

                    RY = new ChangeRedYellow(this);
                    YG = new ChangeYellowGreen(this);
                    GY = new ChangeGreenYellow(this);
                    YR = new ChangeYellowRed(this);

                    RY.Thrd.Start(Yellow);
                    YG.Thrd.Start(Green);
                    GY.Thrd.Start(Yellow);
                    YR.Thrd.Start(Red);
                }
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (ProcessUnstarted())
            {
                ChangeLight.precessing = true;

                RY.Thrd.Start(Yellow);
                Thread.Sleep(10);
                YG.Thrd.Start(Green);
                Thread.Sleep(10);
                GY.Thrd.Start(Yellow);
                Thread.Sleep(10);
                YR.Thrd.Start(Red);

                ChangeLight.autoResetEvent.Set();
            }
            else
            {
                if (!ProcessRunning())
                {
                    ChangeLight.precessing = true;

                    RY.Thrd.Abort();
                    YG.Thrd.Abort();
                    GY.Thrd.Abort();
                    YR.Thrd.Abort();

                    RY = new ChangeRedYellow(this, changeLight);
                    YG = new ChangeYellowGreen(this, changeLight);
                    GY = new ChangeGreenYellow(this, changeLight);
                    YR = new ChangeYellowRed(this, changeLight);

                    RY.Thrd.Start(Yellow);
                    YG.Thrd.Start(Green);
                    GY.Thrd.Start(Yellow);
                    YR.Thrd.Start(Red);
                }
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (ProcessUnstarted())
            {
                ChangeLight.precessing = true;

                RY.Thrd.Start(Yellow);
                Thread.Sleep(10);
                YG.Thrd.Start(Green);
                Thread.Sleep(10);
                GY.Thrd.Start(Yellow);
                Thread.Sleep(10);
                YR.Thrd.Start(Red);

            }
            else
            {
                if (!ProcessRunning())
                {
                    ChangeLight.precessing = true;

                    RY.Thrd.Abort();
                    YG.Thrd.Abort();
                    GY.Thrd.Abort();
                    YR.Thrd.Abort();

                    RY = new ChangeRedYellow(this, changeLight);
                    YG = new ChangeYellowGreen(this, changeLight);
                    GY = new ChangeGreenYellow(this, changeLight);
                    YR = new ChangeYellowRed(this, changeLight);

                    RY.Thrd.Start(Yellow);
                    YG.Thrd.Start(Green);
                    GY.Thrd.Start(Yellow);
                    YR.Thrd.Start(Red);
                }
            }
        }
        public MainWindow()
        {
            InitializeComponent();
            def = Green.Fill;

            changeLight = new ChangeLight();

            RY = new ChangeRedYellow(this, changeLight);
            YG = new ChangeYellowGreen(this, changeLight);
            GY = new ChangeGreenYellow(this, changeLight);
            YR = new ChangeYellowRed(this, changeLight);

            myDelegate = new ChangeColor(ChangeColorMethod);
        }
        public MainWindow()
        {
            InitializeComponent();
            def = Green.Fill;

            RY = new ChangeRedYellow(this);
            YG = new ChangeYellowGreen(this);
            GY = new ChangeGreenYellow(this);
            YR = new ChangeYellowRed(this);

            myDelegateYellow = new ChangeColor(ChangeToYellowMethod);
            myDelegateRed = new ChangeColor(ChangeToRedMethod);
            myDelegateGreen = new ChangeColor(ChangeToGreenMethod);
            //Control f = this;
        }