예제 #1
0
 private void removeBookButton_Click(object sender, EventArgs e)
 {
     try
     {
         int index = Convert.ToInt32(indexTextBox.Text);
         BookClosetsList[index].RemoveBook();
         outputRichTextBox.Text = BookCloset2.GetTextInfoForList(BookClosetsList);
     }
     catch (Exception)
     {
         // ignore
     }
 }
예제 #2
0
 private void addToListButton_Click(object sender, EventArgs e)
 {
     try
     {
         int    ownedAmount      = Convert.ToInt32(ownedAmountTextBox.Text);
         double volume           = Convert.ToDouble(volumeTextBox.Text);
         int    shelvesAmount    = Convert.ToInt32(shelvesAmountTextBox.Text);
         int    amountOfBooks    = Convert.ToInt32(amountOfBooksTextBox.Text);
         int    maxAmountOfBooks = Convert.ToInt32(maxAmountOfBooksTextBox.Text);
         if (AreParamsValid(
                 ownedAmount, volume, shelvesAmount, amountOfBooks, maxAmountOfBooks))
         {
             BookClosetsList.Add(new BookCloset2(
                                     ownedAmount, volume, shelvesAmount, amountOfBooks, maxAmountOfBooks));
             outputRichTextBox.Text = BookCloset2.GetTextInfoForList(BookClosetsList);
         }
     }
     catch (Exception)
     {
         // ignore
     }
 }