| | |
| | | /// </summary> |
| | | public event Action<string, string> BlinkLinkParterEvent; |
| | | |
| | | /// <summary> |
| | | /// 属性值改变事件 |
| | | /// </summary> |
| | | public event Func<Yw.Model.HydroParterInfo, bool> PropertyValueChangedEvent; |
| | | |
| | | //水力信息方法 |
| | | private Func<Yw.Model.HydroModelInfo> _hydroInfoFunc = null; |
| | | private Func<List<IHydroCalcuResult>> _allHydroCalcuResultListFunc = null; |
| | | private Func<List<HydroCalcuResult>> _allHydroCalcuResultListFunc = null; |
| | | |
| | | /// <summary> |
| | | /// 初始化数据 |
| | | /// </summary> |
| | | public void InitialData(Func<Yw.Model.HydroModelInfo> hydroInfoFunc, Func<List<IHydroCalcuResult>> allHydroCalcuResultListFunc) |
| | | public void InitialData(Func<Yw.Model.HydroModelInfo> hydroInfoFunc, Func<List<HydroCalcuResult>> allHydroCalcuResultListFunc) |
| | | { |
| | | _hydroInfoFunc = hydroInfoFunc; |
| | | _allHydroCalcuResultListFunc = allHydroCalcuResultListFunc; |
| | | this.hydroParterPropertyCtrl1.InitialData(hydroInfoFunc); |
| | | } |
| | | |
| | | //获取水力信息 |
| | | private Yw.Model.HydroModelInfo GetHydroInfo() |
| | | { |
| | | var hydroInfo = _hydroInfoFunc?.Invoke(); |
| | | if (hydroInfo == null) |
| | | { |
| | | this.hydroParterPropertyCtrl1.SelectedObject = null; |
| | | return default; |
| | | } |
| | | return hydroInfo; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public void SelectParter(long id) |
| | | { |
| | | var hydroInfo = _hydroInfoFunc?.Invoke(); |
| | | var hydroInfo = GetHydroInfo(); |
| | | if (hydroInfo == null) |
| | | { |
| | | this.hydroParterPropertyCtrl1.SelectedObject = null; |
| | | return; |
| | | } |
| | | var allParterList = hydroInfo.GetAllParters(); |
| | | var parter = allParterList.Find(x => x.ID == id); |
| | | var vm = Yw.WinFrmUI.HydroParterPropertyViewModelBuilder.CreateViewModel(parter, allParterList); |
| | | this.hydroParterPropertyCtrl1.SelectedObject = vm; |
| | | var parter = allParterList?.Find(x => x.ID == id); |
| | | SelectParter(parter); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public void SelectParter(string code) |
| | | { |
| | | var hydroInfo = _hydroInfoFunc?.Invoke(); |
| | | var hydroInfo = GetHydroInfo(); |
| | | if (hydroInfo == null) |
| | | { |
| | | this.hydroParterPropertyCtrl1.SelectedObject = null; |
| | | return; |
| | | } |
| | | var allParterList = hydroInfo.GetAllParters(); |
| | | var parter = allParterList.Find(x => x.Code == code); |
| | | var vm = Yw.WinFrmUI.HydroParterPropertyViewModelBuilder.CreateViewModel(parter, allParterList); |
| | | this.hydroParterPropertyCtrl1.SelectedObject = vm; |
| | | var parter = allParterList?.Find(x => x.Code == code); |
| | | SelectParter(parter); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 选择组件 |
| | | /// </summary> |
| | | public void SelectParter(Yw.Model.HydroParterInfo parter, List<Yw.Model.HydroParterInfo> allParterList) |
| | | public void SelectParter(Yw.Model.HydroParterInfo parter) |
| | | { |
| | | var vm = Yw.WinFrmUI.HydroParterPropertyViewModelBuilder.CreateViewModel(parter, allParterList); |
| | | this.hydroParterPropertyCtrl1.SelectedObject = vm; |
| | | var hydroInfo = GetHydroInfo(); |
| | | if (hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (parter != null) |
| | | { |
| | | var vm = Yw.WinFrmUI.HydroParterViewModelBuilder.CreateViewModel(parter, hydroInfo); |
| | | this.hydroParterPropertyCtrl1.SelectedObject = vm; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新计算属性 |
| | | /// 取消选择组件 |
| | | /// </summary> |
| | | public void UpdateCalcuProperty(Yw.WinFrmUI.IHydroCalcuResult rhs) |
| | | public void CancelSelectParter() |
| | | { |
| | | this.hydroParterPropertyCtrl1.SelectedObject = null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新属性 |
| | | /// </summary> |
| | | public void UpdateProperty() |
| | | { |
| | | var vm = this.hydroParterPropertyCtrl1.SelectedObject; |
| | | if (vm == null) |
| | | { |
| | | return; |
| | | } |
| | | vm.UpdateCalcuProperty(rhs); |
| | | vm.UpdateProperty(); |
| | | this.hydroParterPropertyCtrl1.UpdateRows(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新计算属性 |
| | | /// </summary> |
| | | public void UpdateCalcuProperty(Yw.WinFrmUI.HydroCalcuResult calcuResult) |
| | | { |
| | | if (calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | var vm = this.hydroParterPropertyCtrl1.SelectedObject; |
| | | if (vm == null) |
| | | { |
| | | return; |
| | | } |
| | | vm.UpdateCalcuProperty(calcuResult); |
| | | this.hydroParterPropertyCtrl1.UpdateRows(); |
| | | } |
| | | |
| | | //选择曲线 |
| | | private bool HydroParterPropertyCtrl1_SetCurveEvent(HydroParterPropertyViewModel propViewModel, string curveType) |
| | | private bool HydroParterPropertyCtrl1_SetCurveEvent(HydroParterViewModel propViewModel, string curveType) |
| | | { |
| | | var hydroInfo = _hydroInfoFunc?.Invoke(); |
| | | if (hydroInfo == null) |
| | |
| | | var input = AssetsMatchingParasHelper.Create(hydroInfo, pumpInfo, _allHydroCalcuResultListFunc?.Invoke()); |
| | | var dlg = new SinglePumpAnalyDlg(); |
| | | dlg.SetBindindData(input); |
| | | //dlg.ReloadDataEvent += (output) => |
| | | //{ |
| | | // bol = AssetsMatchingParasHelper.Apply(hydroInfo, output); |
| | | // if (bol) |
| | | // { |
| | | // propertyViewModel.UpdateProperty(pumpInfo, hydroInfo.GetAllParters()); |
| | | // } |
| | | //}; |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | var bol = AssetsMatchingParasHelper.Apply(hydroInfo, output); |
| | | if (bol) |
| | | { |
| | | propViewModel.UpdateProperty(); |
| | | this.hydroParterPropertyCtrl1.UpdateRows(); |
| | | } |
| | | return bol; |
| | | }; |
| | | dlg.ShowDialog(); |
| | | return true; |
| | | } |
| | |
| | | } |
| | | |
| | | //选择模式 |
| | | private bool HydroParterPropertyCtrl1_SetPatternEvent(HydroParterPropertyViewModel propViewModel, string patternType) |
| | | private bool HydroParterPropertyCtrl1_SetPatternEvent(HydroParterViewModel propViewModel, string patternType) |
| | | { |
| | | switch (patternType) |
| | | { |
| | |
| | | } |
| | | |
| | | //属性发生改变 |
| | | private bool HydroParterPropertyCtrl1_PropertyValueChangedEvent(HydroParterPropertyViewModel obj) |
| | | private bool HydroParterPropertyCtrl1_PropertyValueChangedEvent(HydroParterViewModel parterViewModel) |
| | | { |
| | | return false; |
| | | if (parterViewModel == null) |
| | | { |
| | | return false; |
| | | } |
| | | if (this.PropertyValueChangedEvent == null) |
| | | { |
| | | return false; |
| | | } |
| | | return this.PropertyValueChangedEvent.Invoke(parterViewModel.Vmo); |
| | | } |
| | | |
| | | //属性正在发生改变 |
| | | private bool HydroParterPropertyCtrl1_PropertyValueChangingEvent(HydroParterPropertyViewModel arg) |
| | | private bool HydroParterPropertyCtrl1_PropertyValueChangingEvent(HydroParterViewModel arg) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | //匹配Db |
| | | private bool HydroParterPropertyCtrl1_MatchingDbEvent(HydroParterPropertyViewModel propertyViewModel) |
| | | private bool HydroParterPropertyCtrl1_MatchingDbEvent(HydroParterViewModel propertyViewModel) |
| | | { |
| | | var bol = false; |
| | | if (propertyViewModel == null) |
| | |
| | | bol = AssetsMatchingParasHelper.Apply(hydroInfo, output); |
| | | if (bol) |
| | | { |
| | | propertyViewModel.UpdateProperty(pumpInfo, hydroInfo.GetAllParters()); |
| | | propertyViewModel.UpdateProperty(); |
| | | } |
| | | }; |
| | | dlg.ShowDialog(); |