コード例 #1
0
ファイル: CfgForm.cs プロジェクト: xiechongzhu/Baccarat
        private void BtnAdd2_Click(object sender, EventArgs e)
        {
            BetRule2AddForm dialog = new BetRule2AddForm();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                if (Rule2Exits(dialog.result2, dialog.result1))
                {
                    MessageBox.Show("规则已存在", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                String[] strItem = new string[] { CommonFunction.GameResultToString(dialog.result2), CommonFunction.GameResultToString(dialog.result1),
                                                  dialog.GetBetRules().Count.ToString() };
                ListViewItem item = new ListViewItem(strItem);
                item.Tag = CommonFunction.Clone(dialog.GetBetRules());
                BetListView2.Items.Add(item);
            }
        }
コード例 #2
0
ファイル: CfgForm.cs プロジェクト: xiechongzhu/Baccarat
 private void BtnMod2_Click(object sender, EventArgs e)
 {
     if (BetListView2.SelectedItems.Count > 0)
     {
         ListViewItem    item   = BetListView2.SelectedItems[0];
         BetRule2AddForm dialog = new BetRule2AddForm();
         dialog.SetEditMode();
         dialog.result2 = CommonFunction.StringToGameResult(item.SubItems[0].Text);
         dialog.result1 = CommonFunction.StringToGameResult(item.SubItems[1].Text);
         dialog.SetBetRules((List <BetRule>)item.Tag);
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             item.SubItems[0].Text = CommonFunction.GameResultToString(dialog.result2);
             item.SubItems[1].Text = CommonFunction.GameResultToString(dialog.result1);
             item.SubItems[2].Text = dialog.GetBetRules().Count.ToString();
             item.Tag = CommonFunction.Clone(dialog.GetBetRules());
         }
     }
 }