private void BtnMod1_Click(object sender, EventArgs e) { if (BetListView1.SelectedItems.Count > 0) { ListViewItem item = BetListView1.SelectedItems[0]; BetRule1AddForm dialog = new BetRule1AddForm(); dialog.SetEditMode(); dialog.result = CommonFunction.StringToGameResult(item.SubItems[0].Text); dialog.SetBetRules((List <BetRule>)item.Tag); if (dialog.ShowDialog() == DialogResult.OK) { item.SubItems[0].Text = CommonFunction.GameResultToString(dialog.result); item.SubItems[1].Text = dialog.GetBetRules().Count.ToString(); item.Tag = CommonFunction.Clone(dialog.GetBetRules()); } } }
private void BtnAdd1_Click(object sender, EventArgs e) { BetRule1AddForm dialog = new BetRule1AddForm(); if (dialog.ShowDialog() == DialogResult.OK) { if (Rule1Exits(dialog.result)) { MessageBox.Show("规则已存在", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } String[] strItem = new string[] { CommonFunction.GameResultToString(dialog.result), dialog.GetBetRules().Count.ToString() }; ListViewItem item = new ListViewItem(strItem); item.Tag = CommonFunction.Clone(dialog.GetBetRules()); BetListView1.Items.Add(item); } }