private void button_Add_Click(object sender, EventArgs e) { int cur = BookList.nextBookID; Form_Item item = new Form_Item(cur); item.ReturnBook += (o, e1) => { BookDetail now = item.book; now.BookInfo.buildRawData(); now.BookPrint.buildRawData(); // 填充到 BookList BookList.Add(cur, now, true); // 重新整理内容到 ListView ListViewItem line = listView_Books.Items.Add(cur.ToString()); for (int i = 0; i < 12; i++) { line.SubItems.Add(""); } RefreshBookList(ref now, ref line); if (listView_Books.Items.Count <= 1) { SetWidthListView_Books(-2); } }; item.ShowDialog(); }
private void listViewBooks_DoubleClick(object sender, EventArgs e) { int lineNumber = this.listView_Books.SelectedIndices[0]; var line = this.listView_Books.Items[lineNumber]; string bid = line.SubItems[0].Text; int id = int.Parse(bid); BookDetail book; if (!BookList.tryFind(id, out book)) { return; } Form_Item item = new Form_Item(book); item.ReturnBook += (o, e1) => { BookDetail tmp = item.book; tmp.BookInfo.buildRawData(); tmp.BookPrint.buildRawData(); // 填充到 BookList BookList.ReplaceTo(id, tmp); BookDetail now; BookList.tryFind(id, out now); // 重新整理内容到 ListView RefreshBookList(ref now, ref line); }; item.ShowDialog(); }
private void button_Add_Click(object sender, EventArgs e) { int cur = BookList.nextBookID; Form_Item item = new Form_Item(cur); item.ReturnBook += (o, e1) => { BookDetail now = item.book; now.BookInfo.buildRawData(); now.BookPrint.buildRawData(); // 填充到 BookList BookList.Add(cur, now, true); // 重新整理内容到 ListView ListViewItem line = listView_Books.Items.Add(cur.ToString()); for (int i = 0; i < 12; i++) line.SubItems.Add(""); RefreshBookList(ref now, ref line); if (listView_Books.Items.Count <= 1) SetWidthListView_Books(-2); }; item.ShowDialog(); }
private void listViewBooks_DoubleClick(object sender, EventArgs e) { int lineNumber = this.listView_Books.SelectedIndices[0]; var line = this.listView_Books.Items[lineNumber]; string bid = line.SubItems[0].Text; int id = int.Parse(bid); BookDetail book; if (!BookList.tryFind(id, out book)) return; Form_Item item = new Form_Item(book); item.ReturnBook += (o, e1) => { BookDetail tmp = item.book; tmp.BookInfo.buildRawData(); tmp.BookPrint.buildRawData(); // 填充到 BookList BookList.ReplaceTo(id, tmp); BookDetail now; BookList.tryFind(id, out now); // 重新整理内容到 ListView RefreshBookList(ref now, ref line); }; item.ShowDialog(); }