private void Btn_apply_Click(object sender, EventArgs e) { if (this.cb_nameRule.SelectedIndex == 0) { nameRule = NameRuleEnum.NumberRaise; } var pin = this.tb_startPin.Text; var num = this.numericUpDown1.Value; if (pin == "") { MessageBox.Show("起始针点不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (num <= 0) { MessageBox.Show("未设置有效操作数量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } this.startPin = pin; this.totalNum = (int)num; this.Close(); this.DialogResult = DialogResult.OK; }
private void Btn_apply_Click(object sender, EventArgs e) { this.nameRule = NameRuleEnum.NumberRaise; if (this.tb_startInterfacePoint.Text.Trim() == "") { MessageBox.Show("起始接点不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } this.startInterfacePoint = this.tb_startInterfacePoint.Text.Trim(); var switchStandPointNo = this.cb_switchStandPointNo.Text.Trim(); if (this.rbt_2lineMethod.IsChecked) { this.testMethod = "二线法"; int pointNo; if (!int.TryParse(switchStandPointNo, out pointNo)) { MessageBox.Show("转接台针脚号不为正整数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (pointNo < 1 || pointNo > 384) { MessageBox.Show("请输入大于0小于385之间的正整数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (InterfaceLibCom.IsExistDevicePoint(pointNo.ToString())) { MessageBox.Show("设备起始阵脚已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } this.startPin = pointNo.ToString(); } else if (this.rbt_4lineMethod.IsChecked) { this.testMethod = "四线法"; if (!switchStandPointNo.Contains(",")) { MessageBox.Show("针脚号格式错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string[] _4lineArray = switchStandPointNo.Split(','); if (_4lineArray[0] == "") { MessageBox.Show("针脚号格式错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (_4lineArray[1] == "") { MessageBox.Show("针脚号格式错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (InterfaceLibCom.IsExistDevicePoint(switchStandPointNo)) { MessageBox.Show("设备起始阵脚已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } this.startPin = switchStandPointNo; } int pinNum; if (!int.TryParse(this.tb_PinNum.Text, out pinNum)) { MessageBox.Show("请输入满足条件的操作数量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } this.totalNum = pinNum; if (pinNum < 1) { MessageBox.Show("执行数量小于1!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.totalNum = 0; } if (this.rbt_2lineMethod.IsChecked) { if (pinNum > maxPin) { this.totalNum = this._2devPointList.Count; } } else if (this.rbt_4lineMethod.IsChecked) { if (pinNum > maxPin / 2) { this.totalNum = this._4devPointList.Count; } } this.startIndex = this.cb_switchStandPointNo.SelectedIndex; this.Close(); this.DialogResult = DialogResult.OK; }