private void button1_Click(object sender, EventArgs e) { if (this.mode_edit) { if (BookAPI.EditBook(Program.books, txtBookID.Text, txtBookName.Text, txtBookAuthor.Text, txtBookCount.Text)) { MessageBox.Show("修改成功"); Close(); return; } MessageBox.Show("修改失败"); } else { if (BookAPI.AddBook(Program.books, txtBookName.Text, txtBookAuthor.Text, txtBookCount.Text)) { MessageBox.Show("添加成功"); Close(); return; } MessageBox.Show("添加失败"); return; } }