private void btnProperty_Click(object sender, EventArgs e) { if (this.lvwHistory.SelectedItems.Count >= 1) { int num = 0; while (num < this.lstHistory.Count) { if (((CLHistory)this.lstHistory[num]).Order.ToString() == this.lvwHistory.SelectedItems[0].Text) { break; } num++; } CLHistory history = null; if (num < this.lstHistory.Count) { DlgHistoryProperty property; history = this.lstHistory[num] as CLHistory; try { property = new DlgHistoryProperty(history); } catch (Exception exception) { MessageBox.Show(exception.Message, "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (property.ShowDialog() == DialogResult.OK) { this.lstHistory[num] = property.History; this.FillListViewItem(this.lvwHistory.SelectedItems[0], history); } } } }
private void btnAdd_Click(object sender, EventArgs e) { DlgHistoryProperty property; try { property = new DlgHistoryProperty(this.lvwHistory.Items.Count + 1); } catch (Exception exception) { MessageBox.Show(exception.Message, "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (property.ShowDialog() == DialogResult.OK) { this.lstHistory.Add(property.History); this.lvwHistory.Items.Add(this.FillListViewItem(property.History)); } }