public override async Task Leave(Plane plane) { // leave the plane and open the leg // verific if contains this plane, // because if haven it dont open the leg if (InPlanes.Contains(plane)) { InPlanes[0] = null; // in open have to invoke is empety IsEmpety?.Invoke(this); } }
public override async Task <bool> Enter(Plane plane) { // verific if can enter the plane and enter the plane // lock to enter only one plane in leg at a time, // enter tow plane in time cause brokend data. lock (_gate) { // the plane can enter if is open or it is in the leg. if (IsOpen || (InPlanes.Contains(plane) && !InEmergency)) { InPlanes[0] = plane; return(true); } else { return(false); } } }