public void readFromFile()
 {
     using (StreamReader garageData = File.OpenText("GarageData.txt"))
     {
         string line;
         string numOfVehicles;
         line = garageData.ReadLine();
         if (line != null)
         {
             numOfVehicles = line;
             for (int i = 0; i < int.Parse(numOfVehicles); i++)
             {
                 string LicennseNumber  = garageData.ReadLine();
                 string userVehicleType = garageData.ReadLine();
                 string dataToUpdate;
                 SupportedVehicles.eSupportedVehicles userVehicleTypeChoice = SupportedVehicles.ParseFromString(userVehicleType);
                 m_NewVehicleToAdd = CreatingNewVehicle.CreatingNewVehicleToGarage(LicennseNumber, userVehicleTypeChoice);
                 List <string> informatinMessage = m_NewVehicleToAdd.InformationMessages;
                 for (int j = 0; j < informatinMessage.Count; j++)
                 {
                     dataToUpdate = garageData.ReadLine();
                     m_NewVehicleToAdd.CheckAndUpdateInformation(dataToUpdate, j);
                 }
                 dataToUpdate = garageData.ReadLine();
                 m_NewVehicleToAdd._VehicleStatus = Vehicle.VehicleStatus.ParseFromString(dataToUpdate);
                 m_GarageSystem.AddVehicleToGarageSystem(m_NewVehicleToAdd);
             }
         }
     }
 }
        private void _buttonAddNewVehicle_Click(object sender, EventArgs e)
        {
            string licennseNumber = LicennseNumberRequest(false);

            if (m_CurrentlicennseNumberRequest.DialogResult != DialogResult.Cancel)
            {
                m_VehicleTypesForm = new VehicleTypesForm();
                while (m_VehicleTypesForm.DialogResult != DialogResult.Cancel && m_VehicleTypesForm.DialogResult != DialogResult.OK)
                {
                    m_VehicleTypesForm.ShowDialog();
                }
                if (m_VehicleTypesForm.DialogResult != DialogResult.Cancel)
                {
                    int userVehicleType = m_VehicleTypesForm.ComboBoxVehicleType + 1;
                    SupportedVehicles.eSupportedVehicles userVehicleTypeChoice = SupportedVehicles.ParseFromString(userVehicleType.ToString());
                    m_NewVehicleToAdd = CreatingNewVehicle.CreatingNewVehicleToGarage(licennseNumber, userVehicleTypeChoice);
                    List <string> informatinMessage = m_NewVehicleToAdd.InformationMessages;
                    m_NewVehicleInformationForm = new NewVehicleInformationForm(informatinMessage);
                    m_NewVehicleInformationForm._buttonOK.Click += _buttonOKNewVehicleI_Click;
                    while (m_NewVehicleInformationForm.DialogResult != DialogResult.OK &&
                           m_NewVehicleInformationForm.DialogResult != DialogResult.Cancel)
                    {
                        m_NewVehicleInformationForm.ShowDialog();
                        if (m_NewVehicleInformationForm.DialogResult != DialogResult.Cancel)
                        {
                            m_GarageSystem.AddVehicleToGarageSystem(m_NewVehicleToAdd);
                            MessageBox.Show("The vehicle was successfully added to the garage system.", "Success!", MessageBoxButtons.OK);
                        }
                    }
                }
            }
        }
 public VehicleTypesForm()
 {
     m_VehicleTypes = SupportedVehicles.SupportedVehiclesToString();
     initializeComponent();
 }