public FrmMatchJiaju(ConfigData.PopertySelection p) { _ps = p; InitializeComponent(); InitDgv(dataGridViewJSelection); InitEvent(); }
/// <summary> /// 匹配夹具 /// </summary> EactConfig.ConfigData.PopertySelection MatchJiaju(ElecManage.ElectrodeInfo info) { EactConfig.ConfigData.PopertySelection result = null; if (info != null) { var p = EactConfig.ConfigData.GetInstance().Poperties.FirstOrDefault(u => u.DisplayName == "夹具类型"); var x = info.CuttingX(_configData.PQBlankStock); var y = info.CuttingY(_configData.PQBlankStock); if (p != null) { foreach (var m in p.Selections) { if (result != null) { break; } var list = EactConfig.MatchJiaju.DeserializeObject(m.Ex1); foreach (var u in list) { if ((IsEquals(x, u.X) && IsEquals(y, u.Y)) || IsEquals(x, u.Y) && IsEquals(y, u.X)) { result = m; break; } } } } } return(result); }
//void dataGridView2_SelectionChanged(object sender, EventArgs e) //{ // bool temp = dataGridViewPSelection.CurrentRow != null && dataGridViewPSelection.CurrentRow.Index >= 0; // btnPSelectionUpdate.Enabled = temp; // btnPSelectionDelete.Enabled = temp; //} void btnPSelectionAdd_Click(object sender, EventArgs e) { bool temp = dataGridViewPoperty.CurrentRow != null && dataGridViewPoperty.CurrentRow.Index >= 0; if (temp) { var obj = new ConfigData.PopertySelection(); var poperty = dataGridViewPoperty.CurrentRow.DataBoundItem as ConfigData.Poperty; new FrmAddOrEdit(obj, () => { poperty.Selections.Add(obj); dataGridViewPSelection.DataSource = poperty.Selections.ToList(); }).ShowDialog(); } }
void btnPSelectionUpdate_Click(object sender, EventArgs e) { bool temp = dataGridViewPSelection.CurrentRow != null && dataGridViewPSelection.CurrentRow.Index >= 0; bool temp1 = dataGridViewPoperty.CurrentRow != null && dataGridViewPoperty.CurrentRow.Index >= 0; if (temp && temp1) { var obj = dataGridViewPSelection.CurrentRow.DataBoundItem as ConfigData.PopertySelection; var newObj = new ConfigData.PopertySelection(); newObj.Value = obj.Value; var poperty = dataGridViewPoperty.CurrentRow.DataBoundItem as ConfigData.Poperty; new FrmAddOrEdit(newObj, () => { obj.Value = newObj.Value; }).ShowDialog(); } dataGridViewPSelection.Refresh(); }