コード例 #1
0
        private void Start_btn_Click(object sender, EventArgs e)
        {
            switch (count)
            {
            case 1:
                NearestCount2 = 2;
                NearestCount1 = 1;
                PictureBoxexClass pictureBoxexClass1 = new PictureBoxexClass(Rocket_pb, Cosmonaut_pb, panel1, Backhround_pb, Money_pb);
                Thread            StartMoveThread1   = new Thread(new ParameterizedThreadStart(StartMovingForThread));
                StartMoveThread1.Start(pictureBoxexClass1);
                count++;
                break;

            case 2:
                NearestCount2 = 1;
                NearestCount1 = 2;
                PictureBoxexClass pictureBoxexClass2 = new PictureBoxexClass(Rocket_pb2, Cosmonaut_pb2, panel2, Backhround_pb2, Money_pb2);
                Thread            StartMoveThread2   = new Thread(new ParameterizedThreadStart(StartMovingForThread));
                StartMoveThread2.Start(pictureBoxexClass2);
                count++;
                break;

            case 3:
                NearestCount2 = 4;
                NearestCount1 = 3;
                PictureBoxexClass pictureBoxexClass3 = new PictureBoxexClass(Rocket_pb3, Cosmonaut_pb3, panel3, Backhround_pb3, Money_pb3);
                Thread            StartMoveThread3   = new Thread(new ParameterizedThreadStart(StartMovingForThread));
                StartMoveThread3.Start(pictureBoxexClass3);
                count++;
                break;

            case 4:
                NearestCount2 = 4;
                NearestCount1 = 3;
                PictureBoxexClass pictureBoxexClass4 = new PictureBoxexClass(Rocket_pb4, Cosmonaut_pb4, panel4, Backhround_pb4, Money_pb4);
                Thread            StartMoveThread4   = new Thread(new ParameterizedThreadStart(StartMovingForThread));
                StartMoveThread4.Start(pictureBoxexClass4);
                count++;
                break;

            case 5:
                MessageBox.Show("К сожалению места больше нет");
                break;
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: alex2704/SinhronizationTask
        private void StartFilm_btn_Click(object sender, EventArgs e)
        {
            switch (count)
            {
            case 1:
                NearestCount2 = 2;
                NearestCount1 = 1;
                PictureBoxexClass pictureBoxexClass1    = new PictureBoxexClass(car_pictureBox, frontPedestrian_pb, trafficLight_pb, ambulance_pb, panel1);
                Thread            StartCrossWalkThread1 = new Thread(new ParameterizedThreadStart(StartCrossWalkForThread));
                StartCrossWalkThread1.Start((pictureBoxexClass1));
                count++;
                break;

            case 2:
                NearestCount2 = 1;
                NearestCount1 = 2;
                PictureBoxexClass pictureBoxexClass2    = new PictureBoxexClass(car2_pictureBox, frontPedestrian2_pb, trafficLight2_pb, ambulance2_pb, panel3);
                Thread            StartCrossWalkThread2 = new Thread(new ParameterizedThreadStart(StartCrossWalkForThread));
                StartCrossWalkThread2.Start((pictureBoxexClass2));
                count++;
                break;

            case 3:
                NearestCount2 = 4;
                NearestCount1 = 3;
                PictureBoxexClass pictureBoxexClass3    = new PictureBoxexClass(car3_pictureBox, frontPedestrian3_pb, trafficLight3_pb, ambulance3_pb, panel2);
                Thread            StartCrossWalkThread3 = new Thread(new ParameterizedThreadStart(StartCrossWalkForThread));
                StartCrossWalkForThread((pictureBoxexClass3));
                count++;
                break;

            case 4:
                NearestCount2 = 4;
                NearestCount1 = 3;
                PictureBoxexClass pictureBoxexClass4    = new PictureBoxexClass(car4_pictureBox, frontPedestrian4_pb, trafficLight4_pb, ambulance4_pb, panel4);
                Thread            StartCrossWalkThread4 = new Thread(new ParameterizedThreadStart(StartCrossWalkForThread));
                StartCrossWalkForThread((pictureBoxexClass4));
                count++;
                break;

            case 5:
                MessageBox.Show("К сожалению больше нет места");
                break;
            }
        }