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; }
public Flight CreateFlightAction(Plane plane, RunwayStation runway, FlightActionsEnum flightAction) { return(new Flight { Plane = plane, RunwayStation = runway, Time = DateTime.Now, FlightAction = flightAction }); }
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 });
//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 }
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; } }