public async void AddFlight(Fligth newFlight)
        {
            // Add new plane to airport, request in server
            if (newFlight != null && newFlight.FlightPlane != null)
            {
                var webPlane = newFlight.FlightPlane;
                var newPlane = new FlightPlane(webPlane);
                LogMessage($"Star new flight plane {newPlane.Id}, destinatio out {newPlane.DestinationOut}");
                _dataService.AddNewPlane(newPlane);
                _clientHtttpSocketService.UpadatePlane(newPlane);

                newPlane.OnEmergency += OnPlaneEmergency;

                if (newPlane.DestinationOut)
                {
                    // if destination out add to terminal
                    _inTermialPlanes.Add(newPlane);
                    EnterPlaneInLeg(newPlane, GetNextLeg(newPlane.State, true));
                }
                else
                {
                    // if destination out add to the inAirPlanesrminal
                    _inAirPlanes.Add(newPlane);
                    EnterPlaneInLeg(newPlane, GetNextLeg(newPlane.State, false));
                }
            }
        }
        private Plane InitPlanes(Plane plane)
        {
            // transform the plane to flight planes and register emergency event
            var tPlane = new FlightPlane(plane);

            tPlane.OnEmergency += OnPlaneEmergency;
            return(tPlane);
        }
Пример #3
0
 public Leg(BaseLeg dbLeg)
 {
     InPlanes = new Plane[1];
     if (dbLeg != null && dbLeg.InPlanes != null && dbLeg.InPlanes[0] != null)
     {
         InPlanes[0] = new FlightPlane(dbLeg.InPlanes[0]);
     }
 }