private void Init() { this._2devPointList = new List <int>(); this._4devPointList = new List <string>(); for (int i = 1; i <= maxPin; i++) { if (!InterfaceLibCom.IsExistDevicePoint(i.ToString())) { this._2devPointList.Add(i); } } for (int i = 1; i <= maxPin; i += 2) { var curPoint = i + "," + (i + 1); if (!InterfaceLibCom.IsExistDevicePoint(curPoint)) { this._4devPointList.Add(curPoint); } } this.rbt_2lineMethod.CheckState = CheckState.Checked; this.cb_switchStandPointNo.Columns.Add("ID"); this.cb_nameRule.MultiColumnComboBoxElement.Columns.Add("rule"); this.cb_nameRule.EditorControl.Rows.Add(NUMBER_RAISE); this.cb_nameRule.SelectedIndex = 0; this.cb_nameRule.EditorControl.ShowColumnHeaders = false; this.cb_nameRule.BestFitColumns(); this.cb_nameRule.EditorControl.Rows[0].IsSelected = false; }
private void Init() { this._2devPointList = new List <int>(); this._4devPointList = new List <string>(); for (int i = 1; i <= maxPin; i++) { if (!InterfaceLibCom.IsExistDevicePoint(i.ToString())) { this._2devPointList.Add(i); } } for (int i = 1; i <= maxPin; i += 2) { var curPoint = i + "," + (i + 1); if (!InterfaceLibCom.IsExistDevicePoint(curPoint)) { this._4devPointList.Add(curPoint); } } this.cb_switchStandPointNo.MultiColumnComboBoxElement.Columns.Add("data"); this.rbt_2lineMethod.CheckState = CheckState.Checked; _2linePindata = new DataTable(); _2linePindata.Columns.Add("ID"); _4linePindata = new DataTable(); _4linePindata.Columns.Add("ID"); }
private List <int> DevPoint2Line() { List <int> list = new List <int>(); for (int i = 1; i <= 384; i++) { if (!InterfaceLibCom.IsExistDevicePoint(i.ToString())) { list.Add(i); } } return(list); }
private List <string> DevPoint4Line() { List <string> list = new List <string>(); for (int i = 1; i <= 384; i += 2) { var curPoint = i + "," + (i + 1); if (!InterfaceLibCom.IsExistDevicePoint(curPoint)) { list.Add(curPoint); } } return(list); }
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; }
private void Btn_apply_Click(object sender, EventArgs e) { var interfacePointName = this.tb_InterfacePointName.Text.Trim(); var switchStandPointNo = this.cb_switchStandPointNo.Text.Trim(); if (interfacePointName == "") { MessageBox.Show("接点名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (switchStandPointNo == "") { MessageBox.Show("转接台针脚号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.rbt_2lineMethod.IsChecked) { 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.switchStandPointNo = pointNo.ToString(); } else if (this.rbt_4lineMethod.IsChecked) { 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.switchStandPointNo = switchStandPointNo; } this.interfacePointName = interfacePointName; if (this.rbt_2lineMethod.IsChecked) { testMethod = "二线法"; } else if (this.rbt_4lineMethod.IsChecked) { testMethod = "四线法"; } this.Close(); this.DialogResult = DialogResult.OK; }