| | |
| | | namespace Yw.WinFrmUI |
| | | using DevExpress.XtraEditors; |
| | | using Yw.EPAnet; |
| | | using Yw.WinFrmUI.Page; |
| | | |
| | | namespace Yw.WinFrmUI |
| | | { |
| | | /// <summary> |
| | | /// |
| | |
| | | /// <summary> |
| | | /// 查看模型事件 |
| | | /// </summary> |
| | | public event Action<Yw.Dto.HydroModelDto> ViewModelEvent; |
| | | public event Action<HydroModelVmo> ViewModelEvent; |
| | | |
| | | /// <summary> |
| | | /// 计算模型事件 |
| | | /// </summary> |
| | | public event Action<HydroModelVmo> CalcuModelEvent; |
| | | |
| | | /// <summary> |
| | | /// 校验模型事件 |
| | | /// </summary> |
| | | public event Action<HydroModelVmo> ValidModelEvent; |
| | | |
| | | private List<HydroModelMgrViewModel> _allBindingList = null; |
| | | private Lazy<Yw.BLL.HydroModel> _bll = new(() => new Yw.BLL.HydroModel()); |
| | | private Lazy<Yw.BLL.HydroModelRelation> _bllRelation = new(() => new Yw.BLL.HydroModelRelation()); |
| | | |
| | | |
| | | |
| | | //加载数据 |
| | | private async Task LoadData() |
| | | { |
| | | var allBindingList = await _bll.Value.GetAll(); |
| | | var allBindingRelationList = await _bllRelation.Value.GetAll(); |
| | | var allBindingList = await BLLFactory<Yw.BLL.HydroModel>.Instance.GetAll(); |
| | | var allBindingRelationList = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance.GetAll(); |
| | | _allBindingList = new List<HydroModelMgrViewModel>(); |
| | | if (allBindingList != null && allBindingList.Count > 0) |
| | | { |
| | |
| | | /// <summary> |
| | | /// 查看模型 |
| | | /// </summary> |
| | | protected virtual void ViewModel(Yw.Dto.HydroModelDto dto) |
| | | protected virtual async void ViewModel(HydroModelVmo vmo) |
| | | { |
| | | var info = await new Yw.BLL.HydroModelInfo().GetByID(vmo.ID); |
| | | var guid = new PageGuid() |
| | | { |
| | | Modular = "Hydro", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "HydroQ3d", |
| | | TagName = info.ID.ToString() |
| | | }; |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | var page = new HydroQ3dViewPage(); |
| | | page.SetBindingData(info); |
| | | CreatePage(page, guid); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 计算模型 |
| | | /// </summary> |
| | | protected virtual async void CalcuModel(HydroModelVmo vmo) |
| | | { |
| | | var info = await new Yw.BLL.HydroModelInfo().GetByID(vmo.ID); |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(info); |
| | | var list = netWork.Calcu(); |
| | | XtraMessageBox.Show(JsonHelper.Object2FormatJson(list)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 校验模型 |
| | | /// </summary> |
| | | protected virtual async void ValidModel(HydroModelVmo vmo) |
| | | { |
| | | var info = await new Yw.BLL.HydroModelInfo().GetByID(vmo.ID); |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(info); |
| | | var result = netWork.Check(); |
| | | XtraMessageBox.Show(JsonHelper.Object2FormatJson(result)); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | //查看模型 |
| | | //模型查看 |
| | | private void barBtnViewModel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var vm = GetCurrentViewModel(); |
| | |
| | | { |
| | | return; |
| | | } |
| | | ViewModel(vm.Dto); |
| | | this.ViewModelEvent?.Invoke(vm.Dto); |
| | | ViewModel(vm.Vmo); |
| | | this.ViewModelEvent?.Invoke(vm.Vmo); |
| | | } |
| | | |
| | | //模型计算 |
| | | private void barBtnCalcuModel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var vm = GetCurrentViewModel(); |
| | | if (vm == null) |
| | | { |
| | | return; |
| | | } |
| | | CalcuModel(vm.Vmo); |
| | | this.CalcuModelEvent?.Invoke(vm.Vmo); |
| | | |
| | | } |
| | | |
| | | //模型校验 |
| | | private void barBtnValidModel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var vm = GetCurrentViewModel(); |
| | | if (vm == null) |
| | | { |
| | | return; |
| | | } |
| | | ValidModel(vm.Vmo); |
| | | this.ValidModelEvent?.Invoke(vm.Vmo); |
| | | } |
| | | |
| | | //导出inp |
| | | private async void barBtnExportInp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var vm = GetCurrentViewModel(); |
| | | if (vm == null) |
| | | { |
| | | return; |
| | | } |
| | | var info = await new Yw.BLL.HydroModelInfo().GetByID(vm.ID); |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(info); |
| | | var result = netWork.ToInpString(); |
| | | XtraMessageBox.Show(result); |
| | | } |
| | | |
| | | //组件 |
| | | private async void barBtnParter_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var vm = GetCurrentViewModel(); |
| | | if (vm == null) |
| | | { |
| | | return; |
| | | } |
| | | var info = await new Yw.BLL.HydroModelInfo().GetByID(vm.ID); |
| | | var dlg = new HydroParterListDlg(); |
| | | dlg.SetBindingData(info); |
| | | dlg.Show(); |
| | | } |
| | | |
| | | //上移 |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | private async void barBtnTest_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var vm = GetCurrentViewModel(); |
| | | if (vm == null) |
| | | { |
| | | return; |
| | | } |
| | | var info = await new Yw.BLL.HydroModelInfo().GetByID(vm.ID); |
| | | var guid = new PageGuid() |
| | | { |
| | | Modular = "Hydro", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "HydroL2d", |
| | | TagName = info.ID.ToString() |
| | | }; |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | var page = new HydroL2dViewPage(); |
| | | page.SetBindingData(info); |
| | | CreatePage(page, guid); |
| | | } |
| | | } |
| | | } |
| | | } |