/// <summary> /// 返回指定位置实例 /// </summary> /// <param name="strTableName">指定平台名称</param> /// <param name="strPosName">指定位置名称</param> /// <returns></returns> static public TablePosItem TablePosItem(string strTableName, string strPosName) { try { return(tablesDoc.m_tableDictionary[strTableName].tablePosData.tablePosItemDictionary[strPosName]); } catch { if (tablesDoc.m_tableDictionary.Keys.Contains(strTableName) == false) { //MainModule.FormMain.m_formAlarm.Show(); //HandleraAlarmEvent.Invoke("不存在名字为:" + strTableName + "的平台数据"); MainModule.FormMain.m_formAlarm.InsertAlarmMessage("不存在名字为:" + strTableName + "的平台数据"); TableData table = new TableData(); tablesDoc.m_tableDictionary.Add(strTableName, table); } if (tablesDoc.m_tableDictionary[strTableName].tablePosData.tablePosItemDictionary.ContainsKey(strPosName) == false) { //MainModule.FormMain.m_formAlarm.Show(); //HandleraAlarmEvent("平台:" + strTableName + "不存在名字为:" + strTableName + "的点位置数据"); MainModule.FormMain.m_formAlarm.InsertAlarmMessage("平台:" + strTableName + "不存在名字为:" + strPosName + "的点位置数据"); TablePosItem item = new TablePosItem(); tablesDoc.m_tableDictionary[strTableName].tablePosData.tablePosItemDictionary.Add(strPosName, item); } return(tablesDoc.m_tableDictionary[strTableName].tablePosData.tablePosItemDictionary[strPosName]); } }
private void buttonAdd_Click(object sender, EventArgs e) { if (textBoxPosName.Text == "") { return; } try { TablePosItem item = new TablePosItem(); tbData.tablePosData.tablePosItemDictionary.Add(textBoxPosName.Text, item); tbData.tablePosData.tablePosItemList.Add(item); item.strName = textBoxPosName.Text; dataGridViewPosSetting.Rows.Add(new object[] { item.strName, item.dPosX, item.dPosY, item.dPosZ, item.dPosY, item.bActionX, item.bActionY, item.bActionZ, item.bActionU, item.bRel }); } catch { } }
private void dataGridViewPosSetting_CellValidated(object sender, DataGridViewCellEventArgs e) { try { string strName = dataGridViewPosSetting.Rows[e.RowIndex].Cells[0].Value.ToString(); TablePosItem itemDis = tbData.tablePosData.tablePosItemDictionary[strName]; TablePosItem itemList = tbData.tablePosData.tablePosItemList[e.RowIndex]; if (e.ColumnIndex == 1) { double dValue = double.Parse(dataGridViewPosSetting.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()); itemDis.dPosX = dValue; itemList.dPosX = dValue; } if (e.ColumnIndex == 2) { double dValue = double.Parse(dataGridViewPosSetting.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()); itemDis.dPosY = dValue; itemList.dPosY = dValue; } if (e.ColumnIndex == 3) { double dValue = double.Parse(dataGridViewPosSetting.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()); itemDis.dPosZ = dValue; itemList.dPosZ = dValue; } if (e.ColumnIndex == 4) { double dValue = double.Parse(dataGridViewPosSetting.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()); itemDis.dPosU = dValue; itemList.dPosU = dValue; } if (e.ColumnIndex == 5) { bool bValue = bool.Parse(dataGridViewPosSetting.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()); itemDis.bActionX = bValue; itemList.bActionX = bValue; } if (e.ColumnIndex == 6) { bool bValue = bool.Parse(dataGridViewPosSetting.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()); itemDis.bActionY = bValue; itemList.bActionY = bValue; } if (e.ColumnIndex == 7) { bool bValue = bool.Parse(dataGridViewPosSetting.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()); itemDis.bActionZ = bValue; itemList.bActionZ = bValue; } if (e.ColumnIndex == 8) { bool bValue = bool.Parse(dataGridViewPosSetting.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()); itemDis.bActionU = bValue; itemList.bActionU = bValue; } if (e.ColumnIndex == 9) { bool bValue = bool.Parse(dataGridViewPosSetting.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()); itemDis.bRel = bValue; itemList.bRel = bValue; } } catch { } }