| | |
| | | /// </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<HydroCalcuResult>> _allHydroCalcuResultListFunc = null; |
| | |
| | | this.hydroParterPropertyCtrl1.InitialData(hydroInfoFunc); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 选择组件 |
| | | /// </summary> |
| | | public void SelectParter(long id) |
| | | //获取水力信息 |
| | | 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 = GetHydroInfo(); |
| | | if (hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = hydroInfo.GetAllParters(); |
| | | var parter = allParterList.Find(x => x.ID == id); |
| | | var vm = Yw.WinFrmUI.HydroParterPropertyViewModelBuilder.CreateViewModel(parter, hydroInfo); |
| | | 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, hydroInfo); |
| | | 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 hydroInfo = _hydroInfoFunc?.Invoke(); |
| | | var hydroInfo = GetHydroInfo(); |
| | | if (hydroInfo == null) |
| | | { |
| | | this.hydroParterPropertyCtrl1.SelectedObject = null; |
| | | return; |
| | | } |
| | | var vm = Yw.WinFrmUI.HydroParterPropertyViewModelBuilder.CreateViewModel(parter, hydroInfo); |
| | | if (parter != null) |
| | | { |
| | | var vm = Yw.WinFrmUI.HydroParterViewModelBuilder.CreateViewModel(parter, hydroInfo); |
| | | this.hydroParterPropertyCtrl1.SelectedObject = vm; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新计算属性 |
| | | /// 取消选择组件 |
| | | /// </summary> |
| | | public void UpdateCalcuProperty(Yw.WinFrmUI.HydroCalcuResult 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(); |
| | | } |
| | | |
| | |
| | | var bol = AssetsMatchingParasHelper.Apply(hydroInfo, output); |
| | | if (bol) |
| | | { |
| | | propViewModel.Update(); |
| | | propViewModel.UpdateProperty(); |
| | | this.hydroParterPropertyCtrl1.UpdateRows(); |
| | | } |
| | | return bol; |
| | |
| | | } |
| | | |
| | | //属性发生改变 |
| | | private bool HydroParterPropertyCtrl1_PropertyValueChangedEvent(HydroParterViewModel obj) |
| | | private bool HydroParterPropertyCtrl1_PropertyValueChangedEvent(HydroParterViewModel parterViewModel) |
| | | { |
| | | if (parterViewModel == null) |
| | | { |
| | | return false; |
| | | } |
| | | if (this.PropertyValueChangedEvent == null) |
| | | { |
| | | return false; |
| | | } |
| | | return this.PropertyValueChangedEvent.Invoke(parterViewModel.Vmo); |
| | | } |
| | | |
| | | //属性正在发生改变 |
| | |
| | | bol = AssetsMatchingParasHelper.Apply(hydroInfo, output); |
| | | if (bol) |
| | | { |
| | | propertyViewModel.Update(); |
| | | propertyViewModel.UpdateProperty(); |
| | | } |
| | | }; |
| | | dlg.ShowDialog(); |