/// <summary> /// 更新属性面板 /// </summary> /// <param name="isSyncTz">是否是同步台帐调用次方法</param> private void SelectDevAttribute(bool isSyncTz) { var value = DevEventHandler.GetDevTables(CurrentFno, CurrentFid); if (value == null) { return; } if (value.DevObj == null) { return; } GenerateHelper.SetAllBrowsable(value.DevObj, true); isLTTID = DBEntityFinder.Instance.VerifyLTTID(CurrentFid); if (!isLTTID) { PublicMethod.Instance.ShowMessage("\n当前设备未被锁定,禁止编辑..."); GenerateHelper.SetAllReadOnly(value.DevObj, true); } else { if (isSyncTz) { GenerateHelper.SetAllReadOnly(value.DevObj, false); } DevPropertyGrid.Enabled = true; } AutoGenerationHelper.Instance.AddUITypeEditor(value.DevObj, CurrentFno); GenerateHelper.GenerateXPropsByAzwz(value.DevObj, CurrentFno, false); DevPropertyGrid.SelectedObject = value.DevObj; CurPropertyObj = value.DevObj; if (!DBEntityFinder.Instance.MemoryDevice.Keys.Contains(CurrentFno)) { DBEntityFinder.Instance.MemoryDevice.Add(CurrentFno, CurPropertyObj); } else { DBEntityFinder.Instance.MemoryDevice[CurrentFno] = CurPropertyObj; } DevPropertyGrid.Refresh(); var simpleSymbolConfigEntry = SimpleDBSymbolsConfig.Instance.DBSymbol.SingleOrDefault(o => o.G3E_FNO == CurrentFno); if (simpleSymbolConfigEntry != null) { DevNameGroup.Text = simpleSymbolConfigEntry.OtherProperty.LayerName + "(*表示必填项)-" + CurrentFid.ToString(CultureInfo.InvariantCulture); } //保证面板属性和点击设备对应 isclickDev = true; oldFno = 0; //绑定受电馈线 GetSDKXBEntity(); }
private void listView1_MouseDoubleClick(object sender, MouseEventArgs e) { try { if (e.Button == MouseButtons.Right) { return; } if (!CadDataSource._isLoadDataSource) { PublicMethod.Instance.ShowMessage("请务必先加载数据源!!!"); return; } if (!isInsertSymbol) { //判断是否有其他命令在执行 if (PublicMethod.Instance.IsExecuteSystemCMD("")) { return; } var index = listView1.SelectedItems[0].Index; //获取符号路径 var symbolPath = listView1.Items[index].SubItems[0].Name; //获取块名称 var blockName = Path.GetFileNameWithoutExtension(symbolPath); //设置符号库面板焦点 ViewHelper.palette.KeepFocus = false; //新增符号 AddSymbol(symbolPath, blockName); } else { MessageBox.Show("命令未结束!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } catch (Exception ex) { LogManager.Instance.Error(ex); } finally { ViewHelper.palette.KeepFocus = true; if (!IsCustomGroup()) { //只有插入了符号才会清空原来的值 GenerateHelper.EmptyFidRecord(); DBEntityFinder.Instance.EmptyDeviceAttribute(CurPropertyObj); } DevPropertyGrid.Refresh(); } }
/// <summary> /// 清空控件值 /// </summary> private void ClearPropertyGrid() { if (listView1.SelectedItems.Count > 0) { listView1.SelectedItems[0].ForeColor = Color.Empty; } DevPropertyGrid.Text = string.Empty; DevNameGroup.Text = "属性"; isclickDev = false; CurrentFno = oldFno = 0; DevPropertyGrid.SelectedObject = null; CurPropertyObj = null; DevPropertyGrid.Refresh(); }
private void DevPropertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { ConnectManager.CleanSelcol(); CommonHelp.Instance.ChangeAttributeRunTime(CurPropertyObj, CurrentFno, new List <long> { CurrentFid }, e.ChangedItem.PropertyDescriptor.Name, e.ChangedItem.Value != null?e.ChangedItem.Value.ToString():null, e.OldValue); DevPropertyGrid.SelectedObject = CurPropertyObj; DevPropertyGrid.Refresh(); //点击了设备但是没有点击图元面板才更新 if (isclickDev) { try { var rdt = DevEventHandler.GetDevTables(CurrentFno, CurrentFid); cadDS.ObjectId tempObjId = CurrentObjId; CommonHelp.Instance.UpdateAttribute(CurPropertyObj, ref tempObjId, rdt); if (tempObjId != CurrentObjId) { CurrentObjId = tempObjId; } } catch (UpdataArgumentException ee) { CommonHelp.Instance.ShowErrorMsg(); if (e.ChangedItem.PropertyDescriptor != null) { GenerateHelper.SetPropertyValue(CurPropertyObj, ee.TableName, ee.FieldName, e.OldValue); } } catch (Exception ex) { LogManager.Instance.Error(ex.Message); } finally { //RefPaletteSet(); EventTriggerFunc(); GenerateHelper.EmptyFidRecord(); } } }
/// <summary> /// 鼠标单击图元面板图元 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void listView1_Click(object sender, EventArgs e) { DevPropertyGrid.Enabled = CadDataSource._isLoadDataSource; Tab_gnwz.SelectedIndex = 0; if (listView1.SelectedItems.Count <= 0) { return; } var index = listView1.SelectedItems[0].Index; if (index == -1) { return; } var blockPath = listView1.Items[index].Name; blockPath = Path.GetFileNameWithoutExtension(blockPath); isclickDev = false; //自定义符号组 if (!IsCustomGroup()) { if (blockPath.Contains("_")) { var idx = blockPath.IndexOf("_", StringComparison.Ordinal); if (idx > 0) { CurrentFno = int.Parse(blockPath.Substring(0, idx)); } } if (CurrentFno != oldFno) { GenerateHelper.EmptyFidRecord();//防止在没有插入之前点击的设备存入的fid值,一旦有新的fno就清空fid var newObj = GenerateObj.Instance.GenderObjByFno(CurrentFno); if (newObj == null) { MessageBox.Show("新增设备正在完善中..."); return; } GenerateHelper.SetAllBrowsable(newObj, true); //设置记忆值 newObj = DBEntityFinder.Instance.GetMemoryDevice(CurrentFno, newObj); GenerateHelper.GenerateXPropsByAzwz(newObj, CurrentFno, true); AutoGenerationHelper.Instance.AddUITypeEditor(newObj, CurrentFno); DevPropertyGrid.SelectedObject = newObj; CurPropertyObj = newObj; DevPropertyGrid.Refresh(); DevPropertyGrid.Text = CurrentFno.ToString(); oldFno = CurrentFno; var simpleSymbolConfigEntry = SimpleDBSymbolsConfig.Instance.DBSymbol.SingleOrDefault(o => o.G3E_FNO == CurrentFno); if (simpleSymbolConfigEntry != null) { DevNameGroup.Text = simpleSymbolConfigEntry.OtherProperty.LayerName + "(*表示必填项)"; } } if (CurrentFno == 144) { var sbmc = GenerateHelper.GetPropertyValue(CurPropertyObj, GenerateHelper.GetCommonTableNameByFno(CurrentFno), "SBMC"); if (sbmc == null || string.IsNullOrEmpty(sbmc.ToString().Trim())) { GenerateHelper.SetPropertyValue(CurPropertyObj, GenerateHelper.GetCommonTableNameByFno(CurrentFno), "SBMC", "站房引线"); DevPropertyGrid.Refresh(); } } } }