using DevExpress.Utils.Svg;
namespace HStation.WinFrmUI
{
public partial class XhsProjectSimulationFunctionMgrCtrl : DevExpress.XtraEditors.XtraUserControl
{
public XhsProjectSimulationFunctionMgrCtrl()
{
InitializeComponent();
this.xhsProjectSimulationSchemeMgrCtrl1.ProjectSiteSelectedChangedEvent += XhsProjectSimulationSchemeMgrCtrl1_ProjectSiteSelectedChangedEvent;
}
///
/// 项目站选择改变事件
///
public event Action ProjectSiteSelectedChangedEvent;
///
/// 显示循环水项目信息事件
///
public event Action ShowXhsProjectInfoEvent;
///
/// 显示循环水项目水力模拟事件
///
public event Action ShowXhsProjectSimulationEvent;
///
/// 创建循环水项目方案事件
///
public event Action CreateXhsProjectSchemeEvent;
///
/// 比较循环水项目方案事件
///
public event Action CompareXhsProjectSchemeEvent;
private long _projectId;//项目id
private XhsProjectVmo _project = null;//项目
private XhsProjectSiteVmo _projectSite = null;//项目站
///
/// 绑定数据
///
public async Task SetBindingData(long projectId)
{
_projectId = projectId;
_project = await BLLFactory.Instance.GetByID(projectId);
await SetBindingData(_project);
}
///
/// 绑定数据
///
public async Task SetBindingData(XhsProjectVmo project)
{
if (project == null)
{
return;
}
_project = project;
_projectId = project.ID;
await this.xhsProjectSimulationSchemeMgrCtrl1.SetBindingData(project);
}
///
/// 重置绑定
///
public void ResetBindingData()
{
this.ShowXhsProjectInfoEvent?.Invoke(this.svgImg32[0]);
}
//元素点击事件
private void accordionControl1_ElementClick(object sender, DevExpress.XtraBars.Navigation.ElementClickEventArgs e)
{
var tag = e.Element.Tag?.ToString();
switch (tag)
{
case "info":
{
this.ShowXhsProjectInfoEvent?.Invoke(this.svgImg32[0]);
}
break;
case "simulation":
{
this.ShowXhsProjectSimulationEvent?.Invoke(this.svgImg32[1]);
}
break;
case "scheme-create":
{
this.CreateXhsProjectSchemeEvent?.Invoke(this.svgImg32[3]);
}
break;
case "scheme-compare":
{
this.CompareXhsProjectSchemeEvent?.Invoke(this.svgImg32[4]);
}
break;
default: break;
}
}
//项目站选择改变事件
private void XhsProjectSimulationSchemeMgrCtrl1_ProjectSiteSelectedChangedEvent(XhsProjectSiteVmo obj)
{
_projectSite = obj;
this.ProjectSiteSelectedChangedEvent?.Invoke(obj);
}
///
/// 添加方案
///
public void AppendScheme(XhsSchemeVmo scheme)
{
this.xhsProjectSimulationSchemeMgrCtrl1.AppendScheme(scheme);
}
}
}