private void FCServiceProxy_OnAirportChanged(object sender, AirportEventArgs e) { StationZeroPlane = null; StationOnePlane = null; StationTwoPlane = null; StationThreePlane = null; StationFourPlane = null; StationFivePlane = null; StationSixPlane = null; StationSevenPlane = null; StationEightPlane = null; Airport = new ObservableCollection <PlaneDTO>(e.ChangedAirport.Planes); foreach (var plane in Airport) { switch (plane.StationId) { case 0: StationZeroPlane = plane; continue; case 1: StationOnePlane = plane; continue; case 2: StationTwoPlane = plane; continue; case 3: StationThreePlane = plane; continue; case 4: StationFourPlane = plane; continue; case 5: StationFivePlane = plane; continue; case 6: StationSixPlane = plane; continue; case 7: StationSevenPlane = plane; continue; case 8: StationEightPlane = plane; continue; default: continue; } } // throw new NotImplementedException(); }
//telling to simulator about parked plane so he can simulate that departure (some time after) #region IFlightControlService Methods /// <summary> /// in each change in the airport the server will send callback to the client /// about the change /// </summary> /// <param name="sender">airport manager</param> /// <param name="e">contain the changed airportDTO</param> private void OnAirportChanged(object sender, AirportEventArgs e) { for (int i = 0; i < callbacks.Count; i++) { callbacks[i].OnAirportChanged(new OnAirportChangedRequest { ChangedAirport = e.ChangedAirport }); } }
//bubble the AirportChanged event up to the WCF service, private void OnAirportChanged(object sender, AirportEventArgs e) { AirportChanged.Invoke(sender, e); }