| | |
| | | using DevExpress.XtraLayout.Utils; |
| | | using DevExpress.XtraVerticalGrid.Events; |
| | | using NetTaste; |
| | | using SQLitePCL; |
| | | using System.Windows.Forms.VisualStyles; |
| | | using Yw.EPAnet; |
| | | |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取水力信息事件 |
| | | /// </summary> |
| | | public event Func<Yw.Model.HydroModelInfo> GetHydroInfoEvent; |
| | | /// <summary> |
| | | /// 选择曲线事件 |
| | | /// </summary> |
| | | public event Func<HydroParterPropertyViewModel, string, bool> SelectCurveEvent; |
| | |
| | | /// 属性值发生改变事件 |
| | | /// </summary> |
| | | public event Func<HydroParterPropertyViewModel, bool> PropertyValueChangedEvent; |
| | | |
| | | /// <summary> |
| | | /// 匹配db事件 |
| | | /// </summary> |
| | | public event Action<Yw.Model.HydroParterInfo> MatchingDbEvent; |
| | | |
| | | //获取水力信息方法 |
| | | private Func<Yw.Model.HydroModelInfo> _hydroInfoFunc = null; |
| | | |
| | | /// <summary> |
| | | /// 初始化数据 |
| | | /// </summary> |
| | | public void InitialData(Func<Yw.Model.HydroModelInfo> hydroInfoFunc) |
| | | { |
| | | _hydroInfoFunc = hydroInfoFunc; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定对象 |
| | |
| | | var vm = GetPropertyViewModel(e.Row); |
| | | if (this.SelectCurveEvent == null || !this.SelectCurveEvent.Invoke(vm, curvePro.CurveType)) |
| | | { |
| | | var hydroInfo = GetHydroInfoEvent?.Invoke(); |
| | | var hydroInfo = _hydroInfoFunc?.Invoke(); |
| | | if (hydroInfo == null) |
| | | { |
| | | return; |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 型号 |
| | | |
| | | var modelTypePro = (IsHydroModelTypeAttribute)descriptor.Attributes[typeof(IsHydroModelTypeAttribute)]; |
| | | if (modelTypePro != null) |
| | | { |
| | | var buttonEdit = new RepositoryItemButtonEdit(); |
| | | buttonEdit.TextEditStyle = TextEditStyles.DisableTextEditor; |
| | | buttonEdit.ButtonClick += delegate |
| | | { |
| | | var hydroInfo = _hydroInfoFunc?.Invoke(); |
| | | if (hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var vm = GetPropertyViewModel(e.Row); |
| | | var allParterList = hydroInfo.GetAllParters(); |
| | | var parter = allParterList?.Find(x => x.Code == vm.Code); |
| | | this.MatchingDbEvent?.Invoke(parter); |
| | | }; |
| | | e.RepositoryItem = buttonEdit; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 模式 |
| | | |
| | | var patternPro = (IsHydroPatternProAttribute)descriptor.Attributes[typeof(IsHydroPatternProAttribute)]; |
| | |
| | | this.PropertyValueChangedEvent?.Invoke(propertyViewModel); |
| | | if (this.PropertyValueChangedEvent == null || !this.PropertyValueChangedEvent.Invoke(propertyViewModel)) |
| | | { |
| | | var hydroInfo = GetHydroInfoEvent?.Invoke(); |
| | | var hydroInfo = _hydroInfoFunc?.Invoke(); |
| | | if (hydroInfo == null) |
| | | { |
| | | return; |