using Mapster;
|
|
namespace Yw.WinFrmUI
|
{
|
public partial class HydroLossCurveMultiWorkingDlg : DevExpress.XtraBars.Ribbon.RibbonForm
|
{
|
public HydroLossCurveMultiWorkingDlg()
|
{
|
InitializeComponent();
|
this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
|
this.layoutControl1.SetupLayoutControl();
|
this.hydroWorkingListViewCtrl1.SelectedChangedEvent += HydroWorkingListViewCtrl1_SelectedChangedEvent;
|
}
|
|
|
private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息
|
private Dictionary<HydroWorkingVmo, HydroCalcuResult> _calcuWorkingDict = null;//工况计算字典
|
private Yw.Model.HydroNodeInfo _node = null;//节点
|
|
/// <summary>
|
/// 绑定数据
|
/// 计算不会改变原有水力信息
|
/// </summary>
|
public void SetBindingData
|
(
|
Yw.Model.HydroModelInfo hydroInfo,
|
List<HydroWorkingVmo> allWorkingList,
|
Yw.Model.HydroNodeInfo node,
|
bool isHead = false,
|
List<HydroEvaluationVmo> allEvaluationList = null
|
)
|
{
|
if (hydroInfo == null)
|
{
|
return;
|
}
|
if (allWorkingList == null || allWorkingList.Count < 1)
|
{
|
return;
|
}
|
if (node == null)
|
{
|
return;
|
}
|
_hydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>();
|
_node = node;
|
|
_calcuWorkingDict = new Dictionary<HydroWorkingVmo, HydroCalcuResult>();
|
foreach (var working in allWorkingList)
|
{
|
_hydroInfo.UpdateWorkingInfo(working.WorkingInfo);
|
var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, isHead, allEvaluationList);
|
_calcuWorkingDict.Add(working, calcuResult);
|
}
|
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.hydroWorkingListViewCtrl1.SetBindingData(allWorkingList);
|
this.hydroLossCurveCompareCtrl1.SetBindingData(_hydroInfo, _calcuWorkingDict, _node);
|
}
|
|
//工况选择改变
|
private void HydroWorkingListViewCtrl1_SelectedChangedEvent(HydroWorkingVmo working)
|
{
|
if (_hydroInfo == null)
|
{
|
return;
|
}
|
if (_node == null)
|
{
|
return;
|
}
|
if (_calcuWorkingDict == null || _calcuWorkingDict.Count < 1)
|
{
|
return;
|
}
|
if (working == null)
|
{
|
return;
|
}
|
if (!_calcuWorkingDict.ContainsKey(working))
|
{
|
return;
|
}
|
this.hydroLossCurveCtrl1.SetBindingData(_hydroInfo, working, _node, _calcuWorkingDict[working]);
|
}
|
|
|
//切换
|
private void barBtnChange_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
var index = this.navigationFrame1.SelectedPageIndex == 0 ? 1 : 0;
|
this.navigationFrame1.SelectedPageIndex = index;
|
}
|
|
|
}
|
}
|