private void BtnAdd3_Click(object sender, EventArgs e) { BetRule3AddForm dialog = new BetRule3AddForm(); if (dialog.ShowDialog() == DialogResult.OK) { if (Rule2Exits(dialog.result3, dialog.result2, dialog.result1)) { MessageBox.Show("规则已存在", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } String[] strItem = new string[] { CommonFunction.GameResultToString(dialog.result3), CommonFunction.GameResultToString(dialog.result2), CommonFunction.GameResultToString(dialog.result1), dialog.GetBetRules().Count.ToString() }; ListViewItem item = new ListViewItem(strItem); item.Tag = CommonFunction.Clone(dialog.GetBetRules()); BetListView3.Items.Add(item); } }
private void BtnMod3_Click(object sender, EventArgs e) { if (BetListView3.SelectedItems.Count > 0) { ListViewItem item = BetListView3.SelectedItems[0]; BetRule3AddForm dialog = new BetRule3AddForm(); dialog.SetEditMode(); dialog.result3 = CommonFunction.StringToGameResult(item.SubItems[0].Text); dialog.result2 = CommonFunction.StringToGameResult(item.SubItems[1].Text); dialog.result1 = CommonFunction.StringToGameResult(item.SubItems[2].Text); dialog.SetBetRules((List <BetRule>)item.Tag); if (dialog.ShowDialog() == DialogResult.OK) { item.SubItems[0].Text = CommonFunction.GameResultToString(dialog.result3); item.SubItems[1].Text = CommonFunction.GameResultToString(dialog.result2); item.SubItems[2].Text = CommonFunction.GameResultToString(dialog.result1); item.SubItems[3].Text = dialog.GetBetRules().Count.ToString(); item.Tag = CommonFunction.Clone(dialog.GetBetRules()); } } }