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; } }
public void UpdateForR1(string flight, int progress) { Airplane a = proxy.GetAirplane(flight); bool emergencyFlag = false; //if its the first time, it sets the U interface if (!R1) { R1 = true; if (a.Status == AStatus.Emergency_landing) { emergencyFlag = true; } attachLabel(flight, "R1", emergencyFlag); Point start = new Point(23, 50); //if the plane wasnt taxied we have to display it on the runway this.Invoke((MethodInvoker) delegate { planeR1.Location = start; planeR1.Show(); lblR1.Location = new Point(18, 75); R1_red.Show(); attachLabel(flight, "R1", emergencyFlag); }); } //otherwise, keep updating this.Invoke((MethodInvoker) delegate { planeR1.Location = new Point(23 + progress * 60, 50); lblR1.Location = new Point(23 + progress * 55, 75); planeR1.Show(); }); //if the progress is 100% (progress = 10) than the animation is stopped if (progress == 10) { //unless it was emergency landing then we occupy the runway for 10 more seconds if (emergencyFlag) { emergencyPlane = planeR1; timerEmergency.Start(); return; } else { this.Invoke((MethodInvoker) delegate { //or prepareRunway method R1_red.Hide(); R1_green.Show(); planeR1.Hide(); R1 = false; }); } //set status of runway and prepare it for future use //Airplane a = this.proxy.GetAirplane(flight); //a.Runway.Status = true; //prepareRunway("R1"); } }