| | |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using DevExpress.Utils.MVVM; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using HStation.WinFrmUI.Xhs; |
| | | using Yw.Model; |
| | | using Yw.WinFrmUI.HydroW3d; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | |
| | | /// </summary> |
| | | public event Action<HydroVisualInfo> FlowEffectPropertyValueChangedEvent; |
| | | |
| | | #endregion |
| | | #endregion 事件集 |
| | | |
| | | #region 属性赋值 |
| | | |
| | | /// <summary> |
| | | /// 允许编辑 |
| | | /// </summary> |
| | | public bool AllowEdit |
| | | { |
| | | get { return this.hydroVisualPropertyCtrl1.AllowEdit; } |
| | | set { this.hydroVisualPropertyCtrl1.AllowEdit = value; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 选择对象 |
| | |
| | | set { this.hydroVisualPropertyCtrl1.SelectedObject = value; } |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 属性赋值 |
| | | |
| | | #region 属性更新 |
| | | |
| | |
| | | case Yw.Hydro.ParterCatalog.Tank: |
| | | { |
| | | var tankViewModel = vm as HydroTankViewModel; |
| | | var input = HydroMatchingHelper.Create(tankViewModel.Vmo, tankViewModel.HydroInfo); |
| | | var dlg = new SimulationTankSingleMatchingDlg(); |
| | | var input = HydroMatchingHelper.Create(tankViewModel); |
| | | var dlg = new AssetsTankSingleMatchingDlg(); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | HydroMatchingHelper.Apply(tankViewModel.HydroInfo, tankViewModel.Vmo, output); |
| | | tankViewModel.UpdateProperty(); |
| | | HydroMatchingHelper.Apply(tankViewModel, output); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | }; |
| | | dlg.SetBindingData(input); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case Yw.Hydro.ParterCatalog.Waterbox: |
| | | { |
| | | var tankViewModel = vm as HydroTankViewModel; |
| | | var input = HydroMatchingHelper.Create(tankViewModel.Vmo, tankViewModel.HydroInfo); |
| | | var dlg = new SimulationTankSingleMatchingDlg(); |
| | | var input = HydroMatchingHelper.Create(tankViewModel); |
| | | var dlg = new AssetsTankSingleMatchingDlg(); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | HydroMatchingHelper.Apply(tankViewModel.HydroInfo, tankViewModel.Vmo, output); |
| | | tankViewModel.UpdateProperty(); |
| | | HydroMatchingHelper.Apply(tankViewModel, output); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | }; |
| | | dlg.SetBindingData(input); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case Yw.Hydro.ParterCatalog.Blunthead: |
| | | { |
| | | |
| | | var bluntheadViewModel = vm as HydroBluntheadViewModel; |
| | | var input = HydroMatchingHelper.Create(bluntheadViewModel); |
| | | var dlg = new SimulationBluntheadSingleMatchingDlg(); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | HydroMatchingHelper.Apply(bluntheadViewModel, output); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | }; |
| | | dlg.SetBindingData(input); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case Yw.Hydro.ParterCatalog.Elbow: |
| | | { |
| | | var elbowViewModel = vm as HydroElbowViewModel; |
| | | var input = HydroMatchingHelper.Create(elbowViewModel.Vmo, elbowViewModel.HydroInfo); |
| | | var input = HydroMatchingHelper.Create(elbowViewModel); |
| | | var dlg = new SimulationElbowSingleMatchingDlg(); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | HydroMatchingHelper.Apply(elbowViewModel.HydroInfo, elbowViewModel.Vmo, output); |
| | | elbowViewModel.UpdateProperty(); |
| | | HydroMatchingHelper.Apply(elbowViewModel, output); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | }; |
| | | dlg.SetBindingData(input); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case Yw.Hydro.ParterCatalog.Threelink: |
| | | { |
| | | |
| | | var threelinkViewModel = vm as HydroThreelinkViewModel; |
| | | var input = HydroMatchingHelper.Create(threelinkViewModel); |
| | | var dlg = new SimulationThreelinkSingleMatchingDlg(); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | HydroMatchingHelper.Apply(threelinkViewModel, output); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | }; |
| | | dlg.SetBindingData(input); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case Yw.Hydro.ParterCatalog.Fourlink: |
| | | { |
| | | |
| | | var fourlinkViewModel = vm as HydroFourlinkViewModel; |
| | | var input = HydroMatchingHelper.Create(fourlinkViewModel); |
| | | var dlg = new SimulationFourlinkSingleMatchingDlg(); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | HydroMatchingHelper.Apply(fourlinkViewModel, output); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | }; |
| | | dlg.SetBindingData(input); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case Yw.Hydro.ParterCatalog.Meter: |
| | | { |
| | | |
| | | var meterViewModel = vm as HydroMeterViewModel; |
| | | var input = HydroMatchingHelper.Create(meterViewModel); |
| | | var dlg = new AssetsMeterSingleMatchingDlg(); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | HydroMatchingHelper.Apply(meterViewModel, output); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | }; |
| | | dlg.SetBindingData(input); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case Yw.Hydro.ParterCatalog.Flowmeter: |
| | | { |
| | | |
| | | var flowmeterViewModel = vm as HydroFlowmeterViewModel; |
| | | var input = HydroMatchingHelper.Create(flowmeterViewModel); |
| | | var dlg = new AssetsFlowmeterSingleMatchingDlg(); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | HydroMatchingHelper.Apply(flowmeterViewModel, output); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | }; |
| | | dlg.SetBindingData(input); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case Yw.Hydro.ParterCatalog.Pressmeter: |
| | | { |
| | | |
| | | var pressmeterViewModel = vm as HydroPressmeterViewModel; |
| | | var input = HydroMatchingHelper.Create(pressmeterViewModel); |
| | | var dlg = new AssetsPressmeterSingleMatchingDlg(); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | HydroMatchingHelper.Apply(pressmeterViewModel, output); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | }; |
| | | dlg.SetBindingData(input); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case Yw.Hydro.ParterCatalog.Nozzle: |
| | | { |
| | | |
| | | var nozzleViewModel = vm as HydroNozzleViewModel; |
| | | var input = HydroMatchingHelper.Create(nozzleViewModel); |
| | | var dlg = new SimulationSprinklerSingleMatchingDlg(); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | HydroMatchingHelper.Apply(nozzleViewModel, output); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | }; |
| | | dlg.SetBindingData(input); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case Yw.Hydro.ParterCatalog.Hydrant: |
| | | { |
| | | |
| | | var hydrantViewModel = vm as HydroHydrantViewModel; |
| | | var input = HydroMatchingHelper.Create(hydrantViewModel); |
| | | var dlg = new SimulationHydrantSingleMatchingDlg(); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | HydroMatchingHelper.Apply(hydrantViewModel, output); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | }; |
| | | dlg.SetBindingData(input); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case Yw.Hydro.ParterCatalog.Pipe: |
| | | { |
| | | var pipeViewModel = vm as HydroPipeViewModel; |
| | | var input = HydroMatchingHelper.Create(pipeViewModel); |
| | | var dlg = new PipeSingMatchingDlg(); |
| | | var dlg = new SimulationPipeSingleMatchingDlg(); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | HydroMatchingHelper.Apply(pipeViewModel.HydroInfo, pipeViewModel.Vmo, output); |
| | | pipeViewModel.UpdateProperty(); |
| | | HydroMatchingHelper.Apply(pipeViewModel, output); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case Yw.Hydro.ParterCatalog.Pump: |
| | | { |
| | | var pumpViewModel = vm as HydroPumpViewModel; |
| | |
| | | var dlg = new SimulationPumpSingleMatchingDlg(); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | HydroMatchingHelper.Apply(pumpViewModel.HydroInfo, pumpViewModel.Vmo, output); |
| | | pumpViewModel.UpdateProperty(); |
| | | HydroMatchingHelper.Apply(pumpViewModel, output); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | }; |
| | | dlg.SetBindingData(input); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case Yw.Hydro.ParterCatalog.Valve: |
| | | { |
| | | |
| | | var valveViewModel = vm as HydroValveViewModel; |
| | | var input = HydroMatchingHelper.Create(valveViewModel); |
| | | var dlg = new AssetsValveSingleMatchingDlg(); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | HydroMatchingHelper.Apply(valveViewModel, output); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | }; |
| | | dlg.SetBindingData(input); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case Yw.Hydro.ParterCatalog.Exchanger: |
| | | { |
| | | |
| | | var exchangerViewModel = vm as HydroExchangerViewModel; |
| | | var input = HydroMatchingHelper.Create(exchangerViewModel); |
| | | var dlg = new AssetsExchangerSingleMatchingDlg(); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | HydroMatchingHelper.Apply(exchangerViewModel, output); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | }; |
| | | dlg.SetBindingData(input); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case Yw.Hydro.ParterCatalog.Compressor: |
| | | { |
| | | |
| | | var compressorViewModel = vm as HydroCompressorViewModel; |
| | | var input = HydroMatchingHelper.Create(compressorViewModel); |
| | | var dlg = new AssetsCompressorSingleMatchingDlg(); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | HydroMatchingHelper.Apply(compressorViewModel, output); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | this.PropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.MarkPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | this.GradingPropertyValueChangedEvent?.Invoke(vm.Vmo); |
| | | }; |
| | | dlg.SetBindingData(input); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | default: break; |
| | | |
| | | default: break; |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | case HydroCurve.Tank: |
| | | { |
| | | |
| | | var tankViewModel = vm as HydroTankViewModel; |
| | | var curveInfo = tankViewModel.HydroInfo.Curves?.Find(x => x.Code == tankViewModel.VolCurve); |
| | | if (curveInfo != null) |
| | | { |
| | | if (long.TryParse(curveInfo.DbId, out long longDbId)) |
| | | { |
| | | var dlg = new AssetsTankCurveVOLViewDlg(); |
| | | dlg.SetBindingData(longDbId); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | |
| | | case HydroCurve.Pump: |
| | | { |
| | | //var pumpInfo = vm.HydroInfo.Pumps?.Find(x => x.Code == vm.Code); |
| | | //if (pumpInfo == null) |
| | | //{ |
| | | // break; |
| | | //} |
| | | //var input = AssetsMatchingParasHelper.Create(vm.HydroInfo, pumpInfo, null); |
| | | //var dlg = new SinglePumpAnalyDlg(); |
| | | //dlg.SetBindindData(input); |
| | | //dlg.ReloadDataEvent += (output) => |
| | | //{ |
| | | // var bol = AssetsMatchingParasHelper.Apply(vm.HydroInfo, output); |
| | | // if (bol) |
| | | // { |
| | | // vm.UpdateProperty(); |
| | | // this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | // } |
| | | // return bol; |
| | | //}; |
| | | //dlg.ShowDialog(); |
| | | //return true; |
| | | var pumpViewModel = vm as HydroPumpViewModel; |
| | | var dlg = new SimulationSinglePumpFeatDlg(); |
| | | dlg.SaveEvent += (working) => |
| | | { |
| | | pumpViewModel.Vmo.LinkStatus = working.LinkStatus; |
| | | pumpViewModel.Vmo.SpeedRatio = working.CurrentHz / pumpViewModel.Vmo.RatedHz; |
| | | pumpViewModel.UpdateProperty(); |
| | | this.hydroVisualPropertyCtrl1.UpdateRows(); |
| | | }; |
| | | dlg.SetBindingData(pumpViewModel); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case HydroCurve.Valve: |
| | | { |
| | | |
| | | var valveViewModel = vm as HydroValveViewModel; |
| | | var curveInfo = valveViewModel.HydroInfo.Curves?.Find(x => x.Code == valveViewModel.ValveSetting); |
| | | if (curveInfo != null) |
| | | { |
| | | if (long.TryParse(curveInfo.DbId, out long longDbId)) |
| | | { |
| | | var dlg = new AssetsValveCurveViewDlg(); |
| | | dlg.SetBindingData(longDbId); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | |
| | | case HydroCurve.Exchanger: |
| | | { |
| | | |
| | | var exchangerViewModel = vm as HydroExchangerViewModel; |
| | | var curveInfo = exchangerViewModel.HydroInfo.Curves?.Find(x => x.Code == exchangerViewModel.CurveQL); |
| | | if (curveInfo != null) |
| | | { |
| | | if (long.TryParse(curveInfo.DbId, out long longDbId)) |
| | | { |
| | | var dlg = new AssetsExchangerCurveQLViewDlg(); |
| | | dlg.SetBindingData(longDbId); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | |
| | | case HydroCurve.Compressor: |
| | | { |
| | | |
| | | var compressorViewModel = vm as HydroCompressorViewModel; |
| | | var curveInfo = compressorViewModel.HydroInfo.Curves?.Find(x => x.Code == compressorViewModel.CurveQL); |
| | | if (curveInfo != null) |
| | | { |
| | | if (long.TryParse(curveInfo.DbId, out long longDbId)) |
| | | { |
| | | var dlg = new AssetsCompressorCurveQLViewDlg(); |
| | | dlg.SetBindingData(longDbId); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | |
| | | default: break; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 事件实现 |
| | | |
| | | #region 事件穿透 |
| | | |
| | |
| | | this.FlowEffectPropertyValueChangedEvent?.Invoke(vm?.Vmo); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 事件穿透 |
| | | } |
| | | } |