using Mapster;
|
using Yw.Vmo;
|
|
namespace HStation.WinFrmUI
|
{
|
public partial class SimulationPumpAnalyCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public SimulationPumpAnalyCtrl()
|
{
|
InitializeComponent();
|
this.layoutControl1.SetupLayoutControl();
|
this.hydroPumpListStateViewCtrl1.SelectedChangedEvent += HydroPumpListStateViewCtrl1_SelectedChangedEvent;
|
}
|
|
private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息
|
private HydroWorkingVmo _working = null;//工况
|
private HydroPumpAnalyViewModel _vm = null;//视图
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData
|
(
|
Yw.Model.HydroModelInfo hydroInfo,
|
HydroWorkingVmo working,
|
HydroCalcuResult calcuResult = null,
|
bool isHead = false,
|
List<HydroEvaluationVmo> allEvaluationList = null
|
)
|
{
|
if (hydroInfo == null)
|
{
|
return;
|
}
|
if (working == null)
|
{
|
return;
|
}
|
_hydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>();
|
_working = working;
|
if (calcuResult == null)
|
{
|
_hydroInfo.UpdateWorkingInfo(working.WorkingInfo);
|
calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, isHead, allEvaluationList);
|
if (!calcuResult.Succeed)
|
{
|
return;
|
}
|
}
|
_vm = HydroPumpAnalyHelper.Create(_hydroInfo, working, calcuResult, isHead, allEvaluationList);
|
this.hydroPumpListStateViewCtrl1.SetBindingData(_hydroInfo);
|
}
|
|
|
//选择改变
|
private void HydroPumpListStateViewCtrl1_SelectedChangedEvent(Yw.Model.HydroPumpInfo pump)
|
{
|
if (pump == null)
|
{
|
return;
|
}
|
if (_hydroInfo == null)
|
{
|
return;
|
}
|
if (_working == null)
|
{
|
return;
|
}
|
if (_vm == null)
|
{
|
return;
|
}
|
var dict = new Dictionary<HydroWorkingVmo, HydroPumpAnalyViewModel>()
|
{
|
{ _working,_vm}
|
};
|
this.simulationPumpAnalyChartCtrl1.SetBindingData(_hydroInfo, pump, dict);
|
}
|
|
|
|
}
|
}
|