public void UpdateForR2(string flight, int progress) { Airplane a = proxy.GetAirplane(flight); bool emergencyFlag = false; //first time the pilot updates, the interface is initiated if (!R2) { R2 = true; if (a.Status == AStatus.Emergency_landing) { emergencyFlag = true; } attachLabel(flight, "R2", emergencyFlag); this.Invoke((MethodInvoker) delegate { planeR2.Location = startR2; planeR2.Show(); lblR2.Location = new Point(startR2.X, startR2.Y + 25); R2_red.Show(); }); } //animation is produced this.Invoke((MethodInvoker) delegate { planeR2.Location = new Point(startR2.X + progress * 50, startR2.Y); lblR2.Location = new Point(startR2.X + progress * 50, startR2.Y + 25); }); //at the end if (progress == 10) { if (emergencyFlag) { timerEmergency.Start(); emergencyPlane = planeR2; return; } else { this.Invoke((MethodInvoker) delegate { //or prepareRunway method R2_red.Hide(); R2_green.Show(); planeR2.Hide(); R2 = false; }); } //set status of runway and prepare it for future use //Airplane a = this.proxy.GetAirplane(flight); //a.Runway.Status = true; //prepareRunway("R2"); } }
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; } }