/* * this method will analysis the results in check box groups * and do ccessory calculation for different situation. */ private void checkBox_CheckedChanged(object sender, EventArgs e) { chekBox = (CheckBox)sender; if (chekBox.Equals(checkBoxAPP)) { if (checkBoxAPP.Checked) accessoriesPrice += ProtectionPlan; else { accessoriesPrice -= ProtectionPlan; } } else if (chekBox.Equals(checkBoxSP)) { if (checkBoxSP.Checked) { accessoriesPrice += ScreenProtector; } else { accessoriesPrice -= ScreenProtector; } } else if (chekBox.Equals(checkBoxLC)) { if (checkBoxLC.Checked) { accessoriesPrice += LeatherCase; } else { accessoriesPrice -= LeatherCase; } } else { // do nothing } }
public void OnlyOneCheck(CheckBox[] ckbList, CheckBox ckb) { int num2; int length = ckbList.Length; bool flag = false; for (num2 = 0; num2 < length; num2++) { if (ckb.Equals(ckbList[num2])) { flag = true; } } if (ckb.Checked && flag) { for (num2 = 0; num2 < length; num2++) { if (!ckb.Equals(ckbList[num2])) { ckbList[num2].Checked = false; ckbList[num2].Enabled = true; } } } }