private void EditBook() { FormEditBook editForm = new FormEditBook(_books.BooksList[listView.SelectedIndices[0]]); editForm.OnError += new EventHandler <EventArgsString>(catchError); DialogResult result = editForm.ShowDialog(); if (result == DialogResult.OK) { ListViewItem _listViewItem = new ListViewItem(_books.BooksList[listView.SelectedIndices[0]].Author, _books.BooksList[listView.SelectedIndices[0]].Title); listView.Items[listView.SelectedIndices[0]].Text = _listViewItem.ToString(); UpdateInformation(_books.BooksList[listView.SelectedIndices[0]]); _checkChanges = true; } }
private void CreateBook() { listView.SelectedItems.Clear(); Book book = new Book(); FormEditBook editForm = new FormEditBook(book); editForm.OnError += new EventHandler <EventArgsString>(catchError); DialogResult result = editForm.ShowDialog(); if (result == DialogResult.OK) { _books.BooksList.Add(book); AddBookToListView(book, listView); UpdateInformation(_books.BooksList[_books.BooksList.Count - 1]); _checkChanges = true; } }