示例#1
0
        //shows the departures or arrivals
        private void showFlights(Boolean arrivals)
        {
            lbFlights.Items.Clear();

            var entries = arrivals ?   GeneralHelpers.GetAirportArrivals(this.Airport, GameObject.GetInstance().GameTime.DayOfWeek) : GeneralHelpers.GetAirportDepartures(this.Airport, GameObject.GetInstance().GameTime.DayOfWeek);

            GameTimeZone tz = this.Airport.Profile.TimeZone;

            foreach (RouteTimeTableEntry entry in entries)
            {
                if (arrivals)
                {
                    TimeSpan flightTime = MathHelpers.GetFlightTime(entry.getDepartureAirport().Profile.Coordinates, entry.Destination.Airport.Profile.Coordinates, entry.Airliner.Airliner.Type);
                    lbFlights.Items.Add(new AirportFlightItem(MathHelpers.ConvertDateTimeToLoalTime(MathHelpers.ConvertEntryToDate(entry).Add(flightTime), tz), entry.Airliner.Airliner.Airline, entry.Destination.Airport == entry.TimeTable.Route.Destination1 ? entry.TimeTable.Route.Destination2 : entry.TimeTable.Route.Destination1, entry.Destination.FlightCode));
                }
                else
                {
                    lbFlights.Items.Add(new AirportFlightItem(MathHelpers.ConvertDateTimeToLoalTime(MathHelpers.ConvertEntryToDate(entry), tz), entry.Airliner.Airliner.Airline, entry.Destination.Airport, entry.Destination.FlightCode));
                }
            }

            /*
             *          GameTimeZone tz = this.Airport.Profile.TimeZone;
             *
             *          lbArrivals.Items.Clear();
             *          lbDepartures.Items.Clear();
             *
             *
             *
             *          foreach (RouteTimeTableEntry entry in GeneralHelpers.GetAirportDepartures(this.Airport, 2))
             *          {
             *              if (entry.Airliner.CurrentFlight != null && entry.Airliner.CurrentFlight.Entry == entry)
             *                  lbDepartures.Items.Add(new AirportFlightItem(MathHelpers.ConvertDateTimeToLoalTime(MathHelpers.ConvertEntryToDate(entry), tz), entry.Airliner.Airliner.Airline, entry.Destination.Airport, entry.Destination.FlightCode, "Planned"));
             *              else
             *                  lbDepartures.Items.Add(new AirportFlightItem(MathHelpers.ConvertDateTimeToLoalTime(MathHelpers.ConvertEntryToDate(entry), tz), entry.Airliner.Airliner.Airline, entry.Destination.Airport, entry.Destination.FlightCode, "Planned"));
             *          }
             *
             *          foreach (RouteTimeTableEntry entry in GeneralHelpers.GetAirportArrivals(this.Airport, 2))
             *          {
             *              TimeSpan flightTime = MathHelpers.GetFlightTime(entry.getDepartureAirport().Profile.Coordinates, entry.Destination.Airport.Profile.Coordinates, entry.Airliner.Airliner.Type);
             *
             *              if (entry.Airliner.CurrentFlight != null && entry == entry.Airliner.CurrentFlight.Entry && entry.Airliner.Status == FleetAirliner.AirlinerStatus.On_route)
             *                  lbArrivals.Items.Add(new AirportFlightItem(MathHelpers.ConvertDateTimeToLoalTime(MathHelpers.ConvertEntryToDate(entry).Add(flightTime), tz), entry.Airliner.Airliner.Airline, entry.Destination.Airport == entry.TimeTable.Route.Destination1 ? entry.TimeTable.Route.Destination2 : entry.TimeTable.Route.Destination1, entry.Destination.FlightCode, string.Format("{0:HH:mm}", entry.Airliner.CurrentFlight.getExpectedLandingTime())));
             *              else
             *                  lbArrivals.Items.Add(new AirportFlightItem(MathHelpers.ConvertDateTimeToLoalTime(MathHelpers.ConvertEntryToDate(entry).Add(flightTime), tz), entry.Airliner.Airliner.Airline, entry.Destination.Airport == entry.TimeTable.Route.Destination1 ? entry.TimeTable.Route.Destination2 : entry.TimeTable.Route.Destination1, entry.Destination.FlightCode, string.Format("{0:HH:mm}", "Planned")));
             *          }   */
        }
        //shows the departures or arrivals
        private void showFlights(Boolean arrivals)
        {
            lbFlights.Items.Clear();

            var entries = arrivals ? GeneralHelpers.GetAirportArrivals(this.Airport, GameObject.GetInstance().GameTime.DayOfWeek) : GeneralHelpers.GetAirportDepartures(this.Airport, GameObject.GetInstance().GameTime.DayOfWeek);

            GameTimeZone tz = this.Airport.Profile.TimeZone;

            foreach (RouteTimeTableEntry entry in entries)
            {
                if (arrivals)
                {
                    TimeSpan flightTime = MathHelpers.GetFlightTime(entry.getDepartureAirport().Profile.Coordinates, entry.Destination.Airport.Profile.Coordinates, entry.Airliner.Airliner.Type);
                    lbFlights.Items.Add(new AirportFlightItem(MathHelpers.ConvertDateTimeToLoalTime(MathHelpers.ConvertEntryToDate(entry).Add(flightTime), tz), entry.Airliner.Airliner.Airline, entry.Destination.Airport == entry.TimeTable.Route.Destination1 ? entry.TimeTable.Route.Destination2 : entry.TimeTable.Route.Destination1, entry.Destination.FlightCode));
                }
                else
                {
                    lbFlights.Items.Add(new AirportFlightItem(MathHelpers.ConvertDateTimeToLoalTime(MathHelpers.ConvertEntryToDate(entry), tz), entry.Airliner.Airliner.Airline, entry.Destination.Airport, entry.Destination.FlightCode));
                }
            }
        }