Esempio n. 1
0
        private void OnButtonCreateClick(object obj, EventArgs args)
        {
            AuxiliaryForm auxiliaryForm = new AuxiliaryForm("Create", new Car("", "", DateTime.Now.Year, DateTime.Now, 0));

            auxiliaryForm.ShowDialog();
            if (auxiliaryForm.ok)
            {
                listCarsSold.Add(auxiliaryForm.lastCar);
                carsSold.Items.Add(auxiliaryForm.lastCar.ToString());
                carsSold.SelectedIndex = listCarsSold.Count - 1;
            }
        }
Esempio n. 2
0
 private void OnButtonEditClick(object obj, EventArgs args)
 {
     if (listCarsSold.Count != 0)
     {
         AuxiliaryForm auxiliaryForm = new AuxiliaryForm("Edit", listCarsSold[carsSold.SelectedIndex]);
         auxiliaryForm.ShowDialog();
         if (auxiliaryForm.ok)
         {
             listCarsSold[carsSold.SelectedIndex]   = auxiliaryForm.lastCar;
             carsSold.Items[carsSold.SelectedIndex] = auxiliaryForm.lastCar;
         }
     }
 }