using DevExpress.Pdf.Native; using Mapster; using Yw.Model; using Yw.Vmo; namespace HStation.WinFrmUI { public partial class SimulationMultiAnalyWorkingDlg : DevExpress.XtraBars.Ribbon.RibbonForm { public SimulationMultiAnalyWorkingDlg() { InitializeComponent(); this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; this.layoutControl1.SetupLayoutControl(); this.hydroWorkingListViewCtrl1.SelectedChangedEvent += HydroWorkingListViewCtrl1_SelectedChangedEvent; } private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息 private List _allWorkingList = null;//所有工况列表 private Dictionary _allCalcuResultDict = null;//计算结果字典 /// /// 绑定数据 /// public void SetBindingData ( Yw.Model.HydroModelInfo hydroInfo, List allMonitorList, List allWorkingList, HydroNodeInfo node, bool isHead = false, List allEvaluationList = null ) { if (hydroInfo == null) { return; } if (allWorkingList == null || allWorkingList.Count < 1) { return; } if (node == null) { return; } _hydroInfo = hydroInfo.Adapt(); _allWorkingList = allWorkingList; _allCalcuResultDict = new Dictionary(); foreach (var working in allWorkingList) { _hydroInfo.UpdateWorkingInfo(working.WorkingInfo); var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, isHead, allEvaluationList); if (calcuResult.Succeed) { var vm = new SimulationMultiAnalyViewModel(); vm.HydroInfo = _hydroInfo; vm.Working = working; vm.Accuracy = HydroAccuracyHelper.Create(_hydroInfo, allMonitorList, working, calcuResult, isHead, allEvaluationList); vm.EnergyAnaly = HydroEnergyAnalyHelper.Create(_hydroInfo, working, calcuResult, isHead, allEvaluationList); vm.LossCurve = HydroLossCurveHelper.Create(_hydroInfo, working, node, calcuResult, isHead, allEvaluationList); vm.LossStatistics = HydroLossStatisticsHelper.Create(_hydroInfo, working, calcuResult, isHead, allEvaluationList); _allCalcuResultDict.Add(working, vm); } } if (allWorkingList.Count < 2) { var working = allWorkingList[0]; this.Text = $"综合分析({working.Name})"; this.groupForWorkingList.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; this.splitter.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; this.groupForAnaly.GroupBordersVisible = false; } this.hydroWorkingListViewCtrl1.SetBindingData(allWorkingList); } //工况选择改变 private void HydroWorkingListViewCtrl1_SelectedChangedEvent(HydroWorkingVmo working) { if (working == null) { return; } if (_allCalcuResultDict == null || _allCalcuResultDict.Count < 1) { return; } if (!_allCalcuResultDict.ContainsKey(working)) { return; } this.simulationMultiAnalyCtrl1.SetBindingData(_allCalcuResultDict[working]); } } }