lixiaojun
2024-12-23 b9c79f595e5ad4684d731f968bf120ff8c52dbd8
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/01-property/SimulationPropertyCtrl.cs
@@ -58,9 +58,18 @@
        /// </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>
        /// 选择对象
@@ -71,7 +80,7 @@
            set { this.hydroVisualPropertyCtrl1.SelectedObject = value; }
        }
        #endregion
        #endregion 属性赋值
        #region 属性更新
@@ -105,7 +114,7 @@
            this.hydroVisualPropertyCtrl1.UpdateRows();
        }
        #endregion
        #endregion 属性更新
        #region 事件实现
@@ -122,30 +131,38 @@
                    {
                        var tankViewModel = vm as HydroTankViewModel;
                        var input = HydroMatchingHelper.Create(tankViewModel);
                        var dlg = new SimulationTankSingleMatchingDlg();
                        var dlg = new AssetsTankSingleMatchingDlg();
                        dlg.ReloadDataEvent += (output) =>
                        {
                            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);
                        var dlg = new SimulationTankSingleMatchingDlg();
                        var dlg = new AssetsTankSingleMatchingDlg();
                        dlg.ReloadDataEvent += (output) =>
                        {
                            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;
@@ -155,11 +172,15 @@
                        {
                            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;
@@ -169,11 +190,15 @@
                        {
                            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;
@@ -183,11 +208,15 @@
                        {
                            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;
@@ -197,53 +226,69 @@
                        {
                            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 SimulationMeterSingleMatchingDlg();
                        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 SimulationFlowmeterSingleMatchingDlg();
                        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 SimulationPressmeterSingleMatchingDlg();
                        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;
@@ -253,11 +298,15 @@
                        {
                            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;
@@ -267,11 +316,15 @@
                        {
                            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;
@@ -281,10 +334,14 @@
                        {
                            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;
@@ -294,55 +351,70 @@
                        {
                            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 SimulationValveSingleMatchingDlg();
                        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 SimulationExchangerSingleMatchingDlg();
                        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 SimulationCompressorSingleMatchingDlg();
                        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;
            }
        }
@@ -360,13 +432,13 @@
                        if (long.TryParse(vm.DbId, out long longDbId))
                        {
                            var tankViewModel = vm as HydroTankViewModel;
                            var dlg = new TankChartShowDlg();
                            dlg.SetBingingData(longDbId);
                            var dlg = new AssetsTankCurveVOLViewDlg();
                            dlg.SetBindingData(longDbId);
                            dlg.ShowDialog();
                        }
                    }
                    break;
                case HydroCurve.Pump:
                    {
                        var pumpViewModel = vm as HydroPumpViewModel;
@@ -382,45 +454,48 @@
                        dlg.ShowDialog();
                    }
                    break;
                case HydroCurve.Valve:
                    {
                        if (long.TryParse(vm.DbId, out long longDbId))
                        {
                            var valveViewModel = vm as HydroValveViewModel;
                            var dlg = new ValveChartShowDlg();
                            dlg.SetBingingData(longDbId);
                            var dlg = new AssetsValveCurveViewDlg();
                            dlg.SetBindingData(longDbId);
                            dlg.ShowDialog();
                        }
                    }
                    break;
                case HydroCurve.Exchanger:
                    {
                        if (long.TryParse(vm.DbId, out long longDbId))
                        {
                            var exchangerViewModel = vm as HydroExchangerViewModel;
                            var dlg = new ExchangerChartShowDlg();
                            dlg.SetBingingData(longDbId);
                            var dlg = new AssetsExchangerCurveQLViewDlg();
                            dlg.SetBindingData(longDbId);
                            dlg.ShowDialog();
                        }
                    }
                    break;
                case HydroCurve.Compressor:
                    {
                        if (long.TryParse(vm.DbId, out long longDbId))
                        {
                            var compressorViewModel = vm as HydroCompressorViewModel;
                            var dlg = new CompressorChartShowDlg();
                            dlg.SetBingingData(longDbId);
                            var dlg = new AssetsCompressorCurveQLViewDlg();
                            dlg.SetBindingData(longDbId);
                            dlg.ShowDialog();
                        }
                    }
                    break;
                default: break;
            }
        }
        #endregion
        #endregion 事件实现
        #region 事件穿透
@@ -468,8 +543,6 @@
            this.FlowEffectPropertyValueChangedEvent?.Invoke(vm?.Vmo);
        }
        #endregion
        #endregion 事件穿透
    }
}