using DevExpress.XtraBars;
namespace HStation.WinFrmUI
{
public partial class AddXhsSchemeDlg : DevExpress.XtraBars.Ribbon.RibbonForm
{
public AddXhsSchemeDlg()
{
InitializeComponent();
this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
this.ribbon.SetFormStyle();
//this.flyoutPanel1.BorderStyle = BorderStyle.None;
//this.flyoutPanel1.OwnerControl = this.sidePanel3dModel;
//this.flyoutPanel1.Options.AnimationType = DevExpress.Utils.Win.PopupToolWindowAnimation.Fade;
//this.flyoutPanel1.Options.AnchorType = DevExpress.Utils.Win.PopupToolWindowAnchor.Bottom;
this.setSchemePumpListCtrl1.ShowFindPanel = false;
this.setSchemeValveListCtrl1.ShowFindPanel = false;
this.setSchemePipeListCtrl1.ShowFindPanel = false;
foreach (var page in this.tabPane1.Pages)
{
if (page.Controls[0] is IHydroParterList ctrl)
{
ctrl.ShowFindPanel = false;
ctrl.HydroClickEvent += async (parter) =>
{
_selectedParter = parter;
await _bimfaceCtrl?.ZoomAndSelectComponent(_selectedParter.Code);
};
ctrl.HydroChangedEvent += (parterList) =>
{
};
}
}
}
private HStation.Vmo.XhsProjectVmo _project = null;//项目
private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//项目站
private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息
private Yw.Model.HydroParterInfo _selectedParter = null; //选择构件
///
/// 绑定数据
///
public async Task SetBindingData
(
HStation.Vmo.XhsProjectVmo project,
HStation.Vmo.XhsProjectSiteVmo projectSite,
Yw.Model.HydroModelInfo hydroInfo
)
{
if (project == null)
{
return;
}
_project = project;
_projectSite = projectSite;
_hydroInfo = hydroInfo;
if (_projectSite == null)
{
_projectSite = await BLLFactory.Instance.GetDefaultByProjectID(_project.ID);
}
if (_hydroInfo == null)
{
var hydroRelation = await BLLFactory.Instance
.GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation);
_hydroInfo = await BLLFactory.Instance.GetByID(hydroRelation.ModelID);
}
this.setSchemePumpListCtrl1.SetBindingData(_hydroInfo);
this.setSchemeValveListCtrl1.SetBindingData(_hydroInfo);
this.setSchemePipeListCtrl1.SetBindingData(_hydroInfo);
ShowBimfaceCtrl();
}
#region Bimface
//bimface控件
private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null;
//获取 bimface 控件
private async Task GetBimfaceCtrl()
{
if (_bimfaceCtrl == null)
{
_bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl();
_bimfaceCtrl.Dock = DockStyle.Fill;
await _bimfaceCtrl.InitialData(_project, _projectSite, () => _hydroInfo);
_bimfaceCtrl.LoadCompletedEvent += () =>
{
//view加载完成事件
if (_hydroInfo == null)
{
return;
}
};
_bimfaceCtrl.HydroMouseLeftClickEvent += (obj) =>
{//鼠标左键点击事件
if (_hydroInfo == null)
{
return;
}
};
}
return _bimfaceCtrl;
}
//显示 bimface 控件
private async void ShowBimfaceCtrl()
{
var bimfaceCtrl = await GetBimfaceCtrl();
this.sidePanel3dModel.Controls.Clear();
this.sidePanel3dModel.Controls.Add(bimfaceCtrl);
}
private void SelectBimfaceParter()
{
}
#endregion
//更新选择组件属性
private void UpdateSelectedParterProperty()
{
if (_selectedParter == null)
{
return;
}
}
private void barCek_CheckedChanged(object sender, ItemClickEventArgs e)
{
if (!this.flyoutPanel1.Visible)
{
this.flyoutPanel1.ShowPopup();
}
else
{
this.flyoutPanel1.HidePopup();
}
}
}
}