| | |
| | | using DevExpress.XtraEditors.Repository; |
| | | using DevExpress.XtraLayout.Utils; |
| | | using DevExpress.XtraVerticalGrid.Events; |
| | | using Yw.Model; |
| | | |
| | | namespace Yw.WinFrmUI |
| | | { |
| | |
| | | /// 分级属性值改变事件 |
| | | /// </summary> |
| | | public event Action<HydroVisualViewModel> GradingPropertyValueChangedEvent; |
| | | /// <summary> |
| | | /// 水流动画属性值改变事件 |
| | | /// </summary> |
| | | public event Action<HydroVisualViewModel> FlowEffectPropertyValueChangedEvent; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 强调连接节点事件 |
| | | /// 第一个参数为本身Code |
| | |
| | | /// </summary> |
| | | public event Action<HydroVisualViewModel> HydroViewEvent; |
| | | |
| | | private HydroChangeHelper _changeHelper = null;//改变辅助类 |
| | | private HydroPropStatusHelper _propStatusHelper = null;//属性状态辅助类 |
| | | |
| | | /// <summary> |
| | | /// 初始化数据 |
| | | /// </summary> |
| | | public void InitialData |
| | | ( |
| | | HydroChangeHelper changeHelper, |
| | | HydroPropStatusHelper propStatusHelper |
| | | ) |
| | | { |
| | | _changeHelper = changeHelper; |
| | | _propStatusHelper = propStatusHelper; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 允许修改 |
| | | /// </summary> |
| | | public bool AllowEdit { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 绑定对象 |
| | |
| | | } |
| | | set |
| | | { |
| | | this.barBtnChangeLink.Visibility = value is HydroLinkViewModel ? BarItemVisibility.Always : BarItemVisibility.Never; |
| | | this.barBtnMatchingDb.Visibility = value == null ? BarItemVisibility.Never : BarItemVisibility.Always; |
| | | this.barBtnView.Visibility = value == null ? BarItemVisibility.Never : BarItemVisibility.Always; |
| | | if (value != null) |
| | | { |
| | | if (value is HydroReservoirViewModel) |
| | | { |
| | | this.barBtnMatchingDb.Visibility = BarItemVisibility.Never; |
| | | } |
| | | else if (value is HydroJunctionViewModel) |
| | | { |
| | | this.barBtnMatchingDb.Visibility = BarItemVisibility.Never; |
| | | } |
| | | } |
| | | this.propertyGridControl1.SelectedObject = value; |
| | | SetSelectedObject(value); |
| | | } |
| | | } |
| | | |
| | | //设置选择对象 |
| | | private void SetSelectedObject(HydroVisualViewModel vm) |
| | | { |
| | | if (this.AllowEdit) |
| | | { |
| | | this.barBtnChangeLink.Visibility = vm is HydroLinkViewModel ? BarItemVisibility.Always : BarItemVisibility.Never; |
| | | this.barBtnMatchingDb.Visibility = vm == null ? BarItemVisibility.Never : BarItemVisibility.Always; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnMatchingDb.Visibility = BarItemVisibility.Never; |
| | | this.barBtnChangeLink.Visibility = BarItemVisibility.Never; |
| | | } |
| | | this.barBtnView.Visibility = vm == null ? BarItemVisibility.Never : BarItemVisibility.Always; |
| | | var selectObj = this.propertyGridControl1.SelectedObject as HydroVisualViewModel; |
| | | this.propertyGridControl1.SelectedObject = vm; |
| | | if (selectObj == vm) |
| | | { |
| | | this.propertyGridControl1.UpdateRows(); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | return; |
| | | } |
| | | var realFieldName = fieldName; |
| | | //属性描述器 |
| | | var descriptor = this.propertyGridControl1.GetPropertyDescriptor(e.Row); |
| | | if (descriptor != null) |
| | | { |
| | | //真实属性名称 |
| | | var realPropAttri = (HydroRealProAttribute)descriptor.Attributes[typeof(HydroRealProAttribute)]; |
| | | if (realPropAttri != null) |
| | | { |
| | | realFieldName = realPropAttri.RealPropName; |
| | | } |
| | | //名称 |
| | | var displayNameAttri = (DisplayNameAttribute)descriptor.Attributes[typeof(DisplayNameAttribute)]; |
| | | if (displayNameAttri != null && !string.IsNullOrEmpty(displayNameAttri.DisplayName)) |
| | |
| | | var vm = GetPropertyViewModel(e.Row); |
| | | if (vm != null) |
| | | { |
| | | var propStatus = vm.GetPropStatus(fieldName); |
| | | if (propStatus != null) |
| | | var propStatusInfo = _propStatusHelper?.GetPropStatusInfo(vm.Code, realFieldName); |
| | | if (propStatusInfo != null) |
| | | { |
| | | switch (propStatus.PropStatus) |
| | | { |
| | | case Yw.Hydro.ePropStatus.Error: |
| | | { |
| | | e.Appearance.ForeColor = Color.Red; |
| | | } |
| | | break; |
| | | case Yw.Hydro.ePropStatus.Normal: |
| | | { |
| | | e.Appearance.ForeColor = Color.Black; |
| | | } |
| | | break; |
| | | case Yw.Hydro.ePropStatus.Lack: |
| | | { |
| | | e.Appearance.ForeColor = Color.Green; |
| | | } |
| | | break; |
| | | case Yw.Hydro.ePropStatus.Abnormal: |
| | | { |
| | | e.Appearance.ForeColor = Color.Orange; |
| | | } |
| | | break; |
| | | case Yw.Hydro.ePropStatus.Matching: |
| | | { |
| | | e.Appearance.ForeColor = Color.Purple; |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | e.Appearance.ForeColor = HydroPropStatusColorHelper.GetColor(propStatusInfo.PropStatus); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | e.CellText = ((DateTime)e.Properties.Value).ToString("yyyy-MM-dd HH:mm:ss"); |
| | | } |
| | | else if (fullTypeName == typeof(string[]).FullName) |
| | | { |
| | | var stringValue = (string[])e.Properties.Value; |
| | | e.CellText = stringValue?.Length.ToString(); |
| | | } |
| | | else |
| | | { |
| | | |
| | | |
| | | var descriptor = this.propertyGridControl1.GetPropertyDescriptor(e.Row); |
| | | if (descriptor != null) |
| | | { |
| | |
| | | } |
| | | |
| | | var descriptor = this.propertyGridControl1.GetPropertyDescriptor(this.propertyGridControl1.FocusedRow); |
| | | var showEditor = (ShowEditorAttribute)descriptor.Attributes[typeof(ShowEditorAttribute)]; |
| | | if (showEditor != null) |
| | | |
| | | if (this.AllowEdit) |
| | | { |
| | | if (!showEditor.ShowEditor) |
| | | var showEditor = (ShowEditorAttribute)descriptor.Attributes[typeof(ShowEditorAttribute)]; |
| | | if (showEditor != null) |
| | | { |
| | | if (!showEditor.ShowEditor) |
| | | { |
| | | e.Cancel = true; |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var showEditorInView = (ShowEditorInViewAttribute)descriptor.Attributes[typeof(ShowEditorInViewAttribute)]; |
| | | if (showEditorInView == null) |
| | | { |
| | | e.Cancel = true; |
| | | return; |
| | | } |
| | | if (!showEditorInView.ShowEditor) |
| | | { |
| | | e.Cancel = true; |
| | | return; |
| | |
| | | |
| | | #region 富文本 |
| | | |
| | | var attri_multi = (MultiTextAttribute)descriptor.Attributes[typeof(MultiTextAttribute)]; |
| | | if (attri_multi != null) |
| | | if (descriptor != null) |
| | | { |
| | | var memoEdit = new RepositoryItemMemoEdit(); |
| | | if (e.Row.Properties.ReadOnly == true) |
| | | var attri_multi = (MultiTextAttribute)descriptor.Attributes[typeof(MultiTextAttribute)]; |
| | | if (attri_multi != null) |
| | | { |
| | | memoEdit.ReadOnly = true; |
| | | var memoEdit = new RepositoryItemMemoEdit(); |
| | | if (e.Row.Properties.ReadOnly == true) |
| | | { |
| | | memoEdit.ReadOnly = true; |
| | | } |
| | | e.RepositoryItem = memoEdit; |
| | | } |
| | | e.RepositoryItem = memoEdit; |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | #region 曲线 |
| | | |
| | | var curvePropAttri = (HydroCurveProAttribute)descriptor.Attributes[typeof(HydroCurveProAttribute)]; |
| | | if (curvePropAttri != null) |
| | | if (descriptor != null) |
| | | { |
| | | var buttonEdit = new RepositoryItemButtonEdit(); |
| | | buttonEdit.TextEditStyle = TextEditStyles.DisableTextEditor; |
| | | buttonEdit.ButtonClick += delegate |
| | | var curvePropAttri = (HydroCurveProAttribute)descriptor.Attributes[typeof(HydroCurveProAttribute)]; |
| | | if (curvePropAttri != null) |
| | | { |
| | | var vm = GetPropertyViewModel(e.Row); |
| | | if (vm == null) |
| | | var buttonEdit = new RepositoryItemButtonEdit(); |
| | | buttonEdit.TextEditStyle = TextEditStyles.DisableTextEditor; |
| | | buttonEdit.ButtonClick += delegate |
| | | { |
| | | return; |
| | | } |
| | | this.SetCurveEvent?.Invoke(vm, curvePropAttri.Curve, curvePropAttri.CurveType); |
| | | }; |
| | | e.RepositoryItem = buttonEdit; |
| | | var vm = GetPropertyViewModel(e.Row); |
| | | if (vm == null) |
| | | { |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(curvePropAttri.CurveType)) |
| | | { |
| | | this.SetCurveEvent?.Invoke(vm, curvePropAttri.Curve, curvePropAttri.CurveType); |
| | | } |
| | | else |
| | | { |
| | | if (e.Row.Properties.Value == null || string.IsNullOrEmpty(e.Row.Properties.Value.ToString())) |
| | | { |
| | | return; |
| | | } |
| | | this.radialMenu1.ShowPopup(MousePosition); |
| | | } |
| | | }; |
| | | e.RepositoryItem = buttonEdit; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 模式 |
| | | |
| | | var patternProAttri = (HydroPatternProAttribute)descriptor.Attributes[typeof(HydroPatternProAttribute)]; |
| | | if (patternProAttri != null) |
| | | if (descriptor != null) |
| | | { |
| | | var buttonEdit = new RepositoryItemButtonEdit(); |
| | | buttonEdit.TextEditStyle = TextEditStyles.DisableTextEditor; |
| | | buttonEdit.ButtonClick += delegate |
| | | var patternProAttri = (HydroPatternProAttribute)descriptor.Attributes[typeof(HydroPatternProAttribute)]; |
| | | if (patternProAttri != null) |
| | | { |
| | | var buttonEdit = new RepositoryItemButtonEdit(); |
| | | buttonEdit.TextEditStyle = TextEditStyles.DisableTextEditor; |
| | | buttonEdit.ButtonClick += delegate |
| | | { |
| | | |
| | | }; |
| | | e.RepositoryItem = buttonEdit; |
| | | }; |
| | | e.RepositoryItem = buttonEdit; |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 标签 |
| | | |
| | | var flagsProAttri = (HydroFlagsProAttribute)descriptor.Attributes[typeof(HydroFlagsProAttribute)]; |
| | | if (flagsProAttri != null) |
| | | if (descriptor != null) |
| | | { |
| | | var buttonEdit = new RepositoryItemButtonEdit(); |
| | | buttonEdit.TextEditStyle = TextEditStyles.DisableTextEditor; |
| | | buttonEdit.ButtonClick += async delegate |
| | | var flagsProAttri = (HydroFlagsProAttribute)descriptor.Attributes[typeof(HydroFlagsProAttribute)]; |
| | | if (flagsProAttri != null) |
| | | { |
| | | var vm = GetPropertyViewModel(e.Row); |
| | | var flagVmoList = await BLLFactory<Yw.BLL.SysFlag>.Instance.GetBySysType(Yw.Hydro.DataType.HydroParter); |
| | | var dbFlagList = flagVmoList?.Select(x => x.Name).Distinct().ToList(); |
| | | var dlg = new SetFlagsDlg(); |
| | | dlg.SetBindingData(dbFlagList, vm.Vmo.Flags); |
| | | dlg.ReloadDataEvent += (flags) => |
| | | var buttonEdit = new RepositoryItemButtonEdit(); |
| | | buttonEdit.TextEditStyle = TextEditStyles.DisableTextEditor; |
| | | buttonEdit.ButtonClick += async delegate |
| | | { |
| | | vm.Vmo.Flags = flags; |
| | | vm.Flags = Yw.Untity.FlagsHelper.ToString(flags); |
| | | UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm); |
| | | var vm = GetPropertyViewModel(e.Row); |
| | | var flagVmoList = await BLLFactory<Yw.BLL.SysFlag>.Instance.GetBySysType(Yw.Hydro.DataType.HydroParter); |
| | | var dbFlagList = flagVmoList?.Select(x => x.Name).Distinct().ToList(); |
| | | var dlg = new SetFlagsDlg(); |
| | | dlg.SetBindingData(dbFlagList, vm.Vmo.Flags); |
| | | dlg.ReloadDataEvent += (flags) => |
| | | { |
| | | vm.Vmo.Flags = flags; |
| | | vm.Flags = Yw.Untity.FlagsHelper.ToString(flags); |
| | | this.propertyGridControl1.UpdateRows(); |
| | | this.propertyGridControl1.RefreshEditor(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | e.RepositoryItem = buttonEdit; |
| | | e.RepositoryItem = buttonEdit; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | if (e.Row.Properties.Value != null) |
| | | { |
| | | var linkCodeAttri = (HydroLinkProAttribute)descriptor.Attributes[typeof(HydroLinkProAttribute)]; |
| | | if (linkCodeAttri != null) |
| | | if (descriptor != null) |
| | | { |
| | | var buttonEdit = new RepositoryItemButtonEdit(); |
| | | buttonEdit.TextEditStyle = TextEditStyles.DisableTextEditor; |
| | | buttonEdit.ButtonClick += delegate |
| | | var linkCodeAttri = (HydroLinkProAttribute)descriptor.Attributes[typeof(HydroLinkProAttribute)]; |
| | | if (linkCodeAttri != null) |
| | | { |
| | | var vm = GetPropertyViewModel(e.Row); |
| | | var vmLink = vm as HydroLinkViewModel; |
| | | this.BlinkLinkNodeEvent?.Invoke(vmLink, e.Row.Properties.Value.ToString()); |
| | | }; |
| | | e.RepositoryItem = buttonEdit; |
| | | var buttonEdit = new RepositoryItemButtonEdit(); |
| | | buttonEdit.TextEditStyle = TextEditStyles.DisableTextEditor; |
| | | buttonEdit.ButtonClick += delegate |
| | | { |
| | | var vm = GetPropertyViewModel(e.Row); |
| | | var vmLink = vm as HydroLinkViewModel; |
| | | this.BlinkLinkNodeEvent?.Invoke(vmLink, e.Row.Properties.Value.ToString()); |
| | | }; |
| | | e.RepositoryItem = buttonEdit; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if (vm is HydroValveViewModel valve) |
| | | { |
| | | if (fieldName == nameof(HydroValveViewModel.ValveSetting)) |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | | switch (valve.Vmo.ValveType) |
| | | { |
| | | case Yw.Hydro.ValveType.PSV: |
| | |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | | if (fieldName == nameof(HydroValveViewModel.ValveOL)) |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | | if (fieldName == nameof(HydroValveViewModel.ValveQL)) |
| | | if (fieldName == nameof(HydroValveViewModel.ValveLength)) |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | | if (fieldName == nameof(HydroValveViewModel.ValveOL)) |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | | if (fieldName == nameof(HydroValveViewModel.ValveQL)) |
| | | if (fieldName == nameof(HydroValveViewModel.ValveLength)) |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | | if (fieldName == nameof(HydroValveViewModel.ValveOL)) |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | | if (fieldName == nameof(HydroValveViewModel.ValveQL)) |
| | | if (fieldName == nameof(HydroValveViewModel.ValveLength)) |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | |
| | | { |
| | | e.Row.Visible = true; |
| | | } |
| | | if (fieldName == nameof(HydroValveViewModel.ValveOL)) |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | | if (fieldName == nameof(HydroValveViewModel.ValveQL)) |
| | | if (fieldName == nameof(HydroValveViewModel.ValveLength)) |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | | if (fieldName == nameof(HydroValveViewModel.ValveOL)) |
| | | { |
| | | e.Row.Visible = true; |
| | | } |
| | | if (fieldName == nameof(HydroValveViewModel.ValveQL)) |
| | | if (fieldName == nameof(HydroValveViewModel.ValveLength)) |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | | if (fieldName == nameof(HydroValveViewModel.ValveOL)) |
| | | if (fieldName == nameof(HydroValveViewModel.ValveLength)) |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | | if (fieldName == nameof(HydroValveViewModel.ValveQL)) |
| | | { |
| | | e.Row.Visible = true; |
| | | } |
| | | } |
| | | break; |
| | |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | | if (fieldName == nameof(HydroValveViewModel.ValveOL)) |
| | | if (fieldName == nameof(HydroValveViewModel.ValveLength)) |
| | | { |
| | | e.Row.Visible = false; |
| | | } |
| | | if (fieldName == nameof(HydroValveViewModel.ValveQL)) |
| | | { |
| | | e.Row.Visible = false; |
| | | e.Row.Visible = true; |
| | | } |
| | | } |
| | | break; |
| | |
| | | } |
| | | vm.UpdateVmoProperty(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm); |
| | | |
| | | var realFieldName = fieldName; |
| | | var descriptor = this.propertyGridControl1.GetPropertyDescriptor(e.Row); |
| | | if (descriptor != null) |
| | | { |
| | | //真实属性名称 |
| | | var realPropAttri = (HydroRealProAttribute)descriptor.Attributes[typeof(HydroRealProAttribute)]; |
| | | if (realPropAttri != null) |
| | | { |
| | | realFieldName = realPropAttri.RealPropName; |
| | | } |
| | | |
| | | var hydroMarkPropAttri = descriptor.Attributes[typeof(HydroMarkProAttribute)]; |
| | | if (hydroMarkPropAttri != null) |
| | | { |
| | |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm); |
| | | } |
| | | |
| | | var hydroFlowDirectionPropAttri = descriptor.Attributes[typeof(HydroFlowDirectionProAttribute)]; |
| | | if (hydroFlowDirectionPropAttri != null) |
| | | { |
| | | this.FlowEffectPropertyValueChangedEvent?.Invoke(vm); |
| | | } |
| | | this.propertyGridControl1.UpdateRows(); |
| | | } |
| | | _changeHelper?.Append(vm.Vmo, eChangeType.Update); |
| | | _propStatusHelper?.UpdatePropStatus(vm.Code, realFieldName, Yw.Hydro.ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过属性控件修改"); |
| | | } |
| | | |
| | | //Db匹配 |
| | |
| | | //改变连接节点 |
| | | private void barBtnChangeLink_ItemClick(object sender, ItemClickEventArgs e) |
| | | { |
| | | var result = XtraMessageBox.Show("是否确认调整上下游?", "询问", MessageBoxButtons.YesNo) == DialogResult.Yes; |
| | | if (!result) |
| | | { |
| | | return; |
| | | } |
| | | var link = this.SelectedObject as HydroLinkViewModel; |
| | | if (link != null) |
| | | { |
| | |
| | | link.StartCode = link.EndCode; |
| | | link.EndCode = tempCode; |
| | | link.UpdateVmoProperty(); |
| | | |
| | | _propStatusHelper?.UpdatePropStatus(link.Code, nameof(link.Vmo.StartCode), Yw.Hydro.ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}调整上下游"); |
| | | _propStatusHelper?.UpdatePropStatus(link.Code, nameof(link.Vmo.EndCode), Yw.Hydro.ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}调整上下游"); |
| | | |
| | | var translation = this.SelectedObject as HydroTranslationViewModel; |
| | | if (translation != null) |
| | | { |
| | | var tempDiameter = translation.StartDiameter; |
| | | translation.StartDiameter = translation.EndDiameter; |
| | | translation.EndDiameter = tempDiameter; |
| | | translation.UpdateVmoProperty(); |
| | | _propStatusHelper?.UpdatePropStatus(translation.Code, nameof(translation.Vmo.StartDiameter), Yw.Hydro.ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}调整上下游"); |
| | | _propStatusHelper?.UpdatePropStatus(translation.Code, nameof(translation.Vmo.EndDiameter), Yw.Hydro.ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}调整上下游"); |
| | | } |
| | | |
| | | var pump = this.SelectedObject as HydroPumpViewModel; |
| | | if (pump != null) |
| | | { |
| | | var tempDiameter = pump.InletDiameter; |
| | | pump.InletDiameter = pump.OutletDiameter; |
| | | pump.OutletDiameter = tempDiameter; |
| | | pump.UpdateVmoProperty(); |
| | | _propStatusHelper?.UpdatePropStatus(pump.Code, nameof(pump.Vmo.InletDiameter), Yw.Hydro.ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}调整上下游"); |
| | | _propStatusHelper?.UpdatePropStatus(pump.Code, nameof(pump.Vmo.OutletDiameter), Yw.Hydro.ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}调整上下游"); |
| | | } |
| | | |
| | | _changeHelper?.Append(link.Vmo, eChangeType.Update); |
| | | |
| | | this.propertyGridControl1.UpdateRows(); |
| | | } |
| | | } |
| | |
| | | |
| | | string caption = string.Empty; |
| | | string descrition = string.Empty; |
| | | |
| | | string realFieldName = fieldName; |
| | | |
| | | |
| | | //属性描述器 |
| | |
| | | { |
| | | descrition = descritionAttri.Description; |
| | | } |
| | | |
| | | //真实属性名称 |
| | | var realPropAttri = (HydroRealProAttribute)descriptor.Attributes[typeof(HydroRealProAttribute)]; |
| | | if (realPropAttri != null) |
| | | { |
| | | realFieldName = realPropAttri.RealPropName; |
| | | } |
| | | } |
| | | |
| | | var propStatus = vm.GetPropStatus(fieldName); |
| | | this.hydroVisualPropertyDescriptionCtrl1.SetBindingData(caption, descrition, propStatus); |
| | | var propStatusInfo = _propStatusHelper?.GetPropStatusInfo(vm.Code, realFieldName); |
| | | this.hydroVisualPropertyDescriptionCtrl1.SetBindingData(caption, descrition, propStatusInfo); |
| | | |
| | | } |
| | | |
| | | //查看曲线 |
| | | private void barBtnViewCurve_ItemClick(object sender, ItemClickEventArgs e) |
| | | { |
| | | var vm = this.SelectedObject; |
| | | if (vm == null) |
| | | { |
| | | return; |
| | | } |
| | | var row = this.propertyGridControl1.FocusedRow; |
| | | var code = row.Properties.Value?.ToString(); |
| | | var curve = vm.HydroInfo.Curves?.Find(x => x.Code == code); |
| | | if (curve == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new HydroCurveViewDlg(); |
| | | dlg.SetBindingData(curve); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //编辑曲线 |
| | | private void barBtnEditCurve_ItemClick(object sender, ItemClickEventArgs e) |
| | | { |
| | | var vm = this.SelectedObject; |
| | | if (vm == null) |
| | | { |
| | | return; |
| | | } |
| | | var row = this.propertyGridControl1.FocusedRow; |
| | | var code = row.Properties.Value?.ToString(); |
| | | var curve = vm.HydroInfo.Curves?.Find(x => x.Code == code); |
| | | if (curve == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new HydroCurveEditDlg(); |
| | | dlg.ReloadDataEvent += (rhs) => |
| | | { |
| | | _changeHelper?.Append(rhs, eChangeType.Update); |
| | | }; |
| | | dlg.SetBindingData(curve); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |