private void AddDelCableInfo(int rowIndex) { var startInterName = this.radGridView1.Rows[rowIndex].Cells[1].Value.ToString(); var startContact = this.radGridView1.Rows[rowIndex].Cells[2].Value.ToString(); var endInterName = this.radGridView1.Rows[rowIndex].Cells[3].Value.ToString(); var endContact = this.radGridView1.Rows[rowIndex].Cells[4].Value.ToString(); CableConfig cableConfig = new CableConfig(); cableConfig.StartInterface = startInterName; cableConfig.StartInterPoint = startContact; cableConfig.EndInterface = endInterName; cableConfig.EndInterPoint = endContact; this.cableDelList.Add(cableConfig); var curExistList = this.cableAddList.Find(m => m.StartInterface == startInterName && m.StartInterPoint == startContact && m.EndInterface == endInterName && m.EndInterPoint == endContact); if (curExistList != null) { this.cableAddList.Remove(curExistList); } //DataRow dataRow = this.cableDelDatasource.NewRow(); //dataRow[COLUMN_START_INTER] = startInterName; //dataRow[COLUMN_START_POINT] = startContact; //dataRow[COLUMN_END_INTER] = endInterName; //dataRow[COLUMN_END_POINT] = endContact; //this.cableDelDatasource.Rows.Add(dataRow); }
/* * 添加规则 * 【二线法】 * 1)起点接口与终点接口为同一个接口: * 起点接点为起始点,长度为终点接点减去起点接点 * */ private void AddSignalConnect(string startContact, string endContact) { if (!IsInterfaceCfgValid()) { return; } //判断是否满足添加条件 if (IsExistConnect(startContact, endContact)) { MessageBox.Show($"已存在连接关系起点接点{startContact}与终点接点{endContact}", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //add to radgridview this.radGridView1.Rows.AddNew(); var rowCount = this.radGridView1.RowCount; this.radGridView1.Rows[rowCount - 1].Cells[0].Value = rowCount; this.radGridView1.Rows[rowCount - 1].Cells[1].Value = this.cb_startInterface.Text; this.radGridView1.Rows[rowCount - 1].Cells[2].Value = startContact; this.radGridView1.Rows[rowCount - 1].Cells[3].Value = this.cb_endInterface.Text; this.radGridView1.Rows[rowCount - 1].Cells[4].Value = endContact; CableConfig cableConfig = new CableConfig(); cableConfig.StartInterface = this.cb_startInterface.Text; cableConfig.StartInterPoint = startContact; cableConfig.EndInterface = this.cb_endInterface.Text; cableConfig.EndInterPoint = endContact; this.cableAddList.Add(cableConfig); //DataRow dataRow = this.cableAddDatasource.NewRow(); //dataRow[COLUMN_ORDER] = rowCount; //dataRow[COLUMN_START_INTER] = this.cb_startInterface.Text; //dataRow[COLUMN_START_POINT] = startContact; //dataRow[COLUMN_END_INTER] = this.cb_endInterface.Text; //dataRow[COLUMN_END_POINT] = endContact; //this.cableAddDatasource.Rows.Add(dataRow); }