/// <summary> /// Method for storing the CarWPF class in a List Collection /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Store_Car_Click(object sender, RoutedEventArgs e) { CarWPF car = new CarWPF(Make, Model, Year, Color, RegNumber); carListBox.Items.Add(car.DisplayCarInfo()); safeHouse.carList.Add(car); }
/// <summary> /// Method for loading the list back into the program from the external .txt file /// </summary> private void LoadData() { StreamReader reader = new StreamReader(DataFile); string line; while ((line = reader.ReadLine()) != null) { var fields = line.Split(new[] { ',' }); CarWPF car = new CarWPF(fields[0], fields[1], int.Parse(fields[2]), fields[3], fields[4]); carListBox.Items.Add(car.DisplayCarInfo()); safeHouse.carList.Add(car); } }