public void MoveLuggage(Luggage luggage)
        {
            AirportBelt belt = SetBeltForLuggage(luggage);

            if (belt != null)
            {
                luggage.Transport(belt);
            }
        }
        private AirportBelt SetBeltForLuggage(Luggage luggage, UpcomingFlight flight)
        {
            Passenger passenger = GetPassenger(luggage.ownerId);

            if (passenger != null)
            {
                UpcomingFlight upcomingFlight = GetFlight(passenger.flightNo);
                if (flight.FlightNo == upcomingFlight.FlightNo)
                {
                    switch (flight.Zone)
                    {
                    case "zoneA": return(GetBelt("beltA"));

                    case "zoneB": return(GetBelt("beltB"));

                    case "zoneC": return(GetBelt("beltC"));

                    default: throw new NotSupportedException();
                    }
                }
            }
            return(null);
        }
Exemple #3
0
 private void ReDrawSimulation()
 {
     foreach (var control in this.Controls)
     {
         if (control is PictureBox)
         {
             PictureBox pb = (PictureBox)control;
             if (pb.Tag != null)
             {
                 Luggage luggage = (Luggage)pb.Tag;
                 pb.Location = luggage.position;
                 if (luggage.position.X > 0 && luggage.status != Status.Loaded)
                 {
                     pb.Visible = true;
                 }
                 else
                 {
                     pb.Visible = false;
                 }
             }
         }
     }
     this.Invalidate();
 }
        private AirportBelt SetBeltForLuggage(Luggage luggage)
        {
            Passenger passenger = GetPassenger(luggage.ownerId);

            if (passenger != null)
            {
                UpcomingFlight flight = GetFlight(passenger.flightNo);
                if (flight != null)
                {
                    switch (flight.Zone)
                    {
                    case "zoneA": return(GetBelt("beltA"));

                    case "zoneB": return(GetBelt("beltB"));

                    case "zoneC": return(GetBelt("beltC"));

                    default:
                        break;
                    }
                }
            }
            return(null);
        }