예제 #1
0
 public void AirlineTest()
 {
     Airline airline = new Airline();
 }
예제 #2
0
 public AirlineViewModel()
 {
     _logfile = @"flights.xml";
     XmlReader<List<Flight>> fileReader = new XmlReader<List<Flight>>(_logfile);
     List<Flight> flights = new List<Flight>();
     _airline = new Airline();
     try
     {
         _airline.ListOfFlights = fileReader?.ReadFromFile() ?? _airline.ListOfFlights;
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
     Locations = _airline.Locations;
     _getFlights = new DelegateCommand<string>(
         (s) => { DisplayListOfFlights(); }, //Execute
         (s) => _destination != null && _origin != null //CanExecute
         );
     _chooseFlight = new DelegateCommand<string>(
         (s) => { ShowBookingInformation(); }
          );
     _chooseSeats = new DelegateCommand<string>(
         (s) => { SeatSelected(); }
         );
     _purchaseSeats = new DelegateCommand<string>(
         (s) => { SellSeats();},
         (s) => !string.IsNullOrEmpty(_firstName) && !string.IsNullOrEmpty(_lastName)
         );
     _isFlightSelected = ListOfFlights.Count != 0;
     _listOfFLights.CollectionChanged += ContentCollectionChanged;
     _rowNumber.CollectionChanged += ContentCollectionChanged;
     _seatButtons.CollectionChanged += ContentCollectionChanged;
     _seatLetter = new ObservableCollection<string>(CreateSeatLetter());
     _seatsSelected.CollectionChanged += ContentCollectionChanged;
     _seatsPurchased.CollectionChanged += ContentCollectionChanged;
     _summary.CollectionChanged += ContentCollectionChanged;
 }