コード例 #1
0
        private void OnRunwayArrival(Plane plane, RunwayStation runway)
        {
            Task.Run(() => notifyService.NewTakeoff(plane));
            //db update!!!!!
            /*Task.Run(() =>*/ Flight flight = CreateFlightAction(plane, runway, plane.FlightAction);

            plane = null;
            runway.CurrentPlane = null;
        }
コード例 #2
0
 public Flight CreateFlightAction(Plane plane, RunwayStation runway, FlightActionsEnum flightAction)
 {
     return(new Flight
     {
         Plane = plane,
         RunwayStation = runway,
         Time = DateTime.Now,
         FlightAction = flightAction
     });
 }
コード例 #3
0
 public IFlight CreateFlightByAction(Plane plane, RunwayStation runway, FlightActionsEnum flightAction)
 {
     return(flightAction switch
     {
         FlightActionsEnum.Landing => new Landing {
             Plane = plane, RunwayStation = runway, Time = DateTime.Now
         },
         FlightActionsEnum.Takeoff => new Takeoff {
             Plane = plane, RunwayStation = runway, Time = DateTime.Now
         },
         _ => null
     });
コード例 #4
0
 //Plane arrive to the airport's airspace and request landing.
 public void NewLandingRequest(Plane plane)
 {
     if (!IsThereLandingWaiter())
     {
         RunwayStation runway = GetRunwayToLand();
         if (runway != null)
         {
             Land(plane, runway);
             return;
         }
     }
     LandingWaiters.Add(plane);
     notifyService.NewLandingWaiter(plane);
     //db update
 }
コード例 #5
0
        private void Land(Plane plane, RunwayStation runway)
        {
            plane.CurrentStation = runway;
            runway.CurrentPlane  = plane;
            //ui update
            Task.Run(() => notifyService.NewLanding(plane));
            Thread.Sleep(2000);
            //db update
            Flight flight = CreateFlightAction(plane, runway, FlightActionsEnum.Landing);
            //!!!!
            MiddleStation station = GetNextStation(runway) as MiddleStation;

            if (station != null)
            {
                MoveToNextStation(station, plane);
                runway.CurrentPlane = null;
            }
        }