コード例 #1
0
        public void UpdateForR3(string flight, int progress)
        {
            Airplane a             = proxy.GetAirplane(flight);
            bool     emergencyFlag = false;

            //first time
            if (!R3)
            {
                R3 = true;
                if (a.Status == AStatus.Emergency_landing)
                {
                    emergencyFlag = true;
                }
                attachLabel(flight, "R3", emergencyFlag);

                this.Invoke((MethodInvoker) delegate
                {
                    planeR3.Location = startR3;
                    lblR3.Location   = new Point(startR3.X, startR3.Y + 25);
                    R3_red.Show();
                });
            }

            //subsequent times
            this.Invoke((MethodInvoker) delegate
            {
                planeR3.Location = new Point(startR3.X + progress * 50, startR3.Y);
                lblR3.Location   = new Point(startR3.X + progress * 50, startR3.Y + 25);
            });

            //at the end
            if (progress == 10)
            {
                if (emergencyFlag)
                {
                    timerEmergency.Start(); emergencyPlane = planeR3; return;
                }

                else
                {  //set interface for end of animation
                    this.Invoke((MethodInvoker) delegate
                    {
                        R3_red.Hide();
                        R3_green.Show();
                        lblR3.Hide();
                        planeR3.Hide();
                        R3 = false;
                        //or prepareRunway method
                    });
                }


                //set status of runway and prepare it for future use
                //Airplane a = this.proxy.GetAirplane(flight);
                //a.Runway.Status = true;
                //prepareRunway("R3");
            }
        }
コード例 #2
0
        private void prepareRunway(string runway)
        {
            switch (runway)
            {
            case "R1":
                R1_red.Hide();
                planeR1.Hide();
                lblR1.Hide();
                break;

            case "R2":
                R2_red.Hide();
                planeR2.Hide();
                lblR2.Hide();
                break;

            case "R3":
                R3_red.Hide();
                lblR3.Hide();
                break;

            case "R4":
                //green one hidden
                pictureBox15.Hide();
                //red one hidden
                pictureBox14.Hide();
                //grey is showed
                pictureBox3.Show();
                //plane is hidden
                pictureBox10.Hide();
                //hide label
                lblR4.Hide();

                R4 = false;
                break;
            }
        }