using DevExpress.Utils.Svg;
|
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
|
using HStation.WinFrmUI.Xhs.PumpProduct;
|
using Yw.WinFrmUI.Page;
|
|
namespace HStation.WinFrmUI
|
{
|
public partial class HomeXhsProjectPage : DocumentPage
|
{
|
public HomeXhsProjectPage()
|
{
|
InitializeComponent();
|
this.PageTitle.Caption = "首页";
|
this.PageTitle.HeaderSvgImage = this.svgImg32[0];
|
this.PageTitle.SvgImageSize = new Size(24, 24);
|
this.PageTitle.AllowClose = false;
|
this.repPicEdit.SizeMode = DevExpress.XtraEditors.Controls.PictureSizeMode.Zoom;
|
}
|
|
//页面类
|
private class CurrentViewModel
|
{
|
public string Name { get; set; }
|
public int Count { get; set; }
|
public SvgImage Image { get; set; }
|
}
|
|
private Lazy<BLL.XhsProjectStd> _bllProjectStd = new(() => new BLL.XhsProjectStd());
|
private List<XhsProjectStdDto> _allProjectList = null;
|
|
private Lazy<BLL.PumpMain> _bllPump = new(() => new BLL.PumpMain());
|
|
/// <summary>
|
/// 初始化数据源
|
/// </summary>
|
public override async void InitialDataSource()
|
{
|
SetBindingData();
|
this.mapViewProjectListContainer1.LoadCompletedEvent += MapViewProjectListContainer1_LoadCompletedEvent;
|
await this.mapViewProjectListContainer1.InitialContainer();
|
}
|
|
private async void SetBindingData()
|
{
|
_allProjectList = await _bllProjectStd.Value.GetAll();
|
var allPump = await _bllPump.Value.GetAll();
|
var vm = new CurrentViewModel()
|
{
|
Name = "项目数量",
|
Count = _allProjectList?.Count ?? 0,
|
Image = ImageLib.Project
|
};
|
|
var vm2 = new CurrentViewModel()
|
{
|
Name = "水泵型号数量",
|
Count = allPump?.Count ?? 0,
|
Image = ImageLib.PumpMain
|
};
|
|
var vm3 = new CurrentViewModel()
|
{
|
Name = "阀门型号数量",
|
Count = 0,
|
Image = ImageLib.Valve
|
};
|
var vm4 = new CurrentViewModel()
|
{
|
Name = "冷却塔数量",
|
Count = 0,
|
Image = ImageLib.CoolingTower
|
};
|
|
var list = new List<CurrentViewModel>() { vm, vm2, vm3, vm4 };
|
this.gridControl1.DataSource = list;
|
this.gridControl1.RefreshDataSource();
|
}
|
|
/// <summary>
|
/// 刷新数据
|
/// </summary>
|
public override async void RefreshData()
|
{
|
base.RefreshData();
|
_allProjectList = await _bllProjectStd.Value.GetAll();
|
await this.mapViewProjectListContainer1.SetProjectList(_allProjectList);
|
this.homeXhsProjectTreeListCtrl1.SetBindingData(_allProjectList);
|
SetBindingData();
|
}
|
|
//地图加载完成
|
private async void MapViewProjectListContainer1_LoadCompletedEvent()
|
{
|
await this.mapViewProjectListContainer1.SetProjectList(_allProjectList);
|
this.homeXhsProjectTreeListCtrl1.SetBindingData(_allProjectList);
|
}
|
|
//选择项目事件
|
private async void homeXhsProjectTreeListCtrl1_SelectProjectEvent(XhsProjectStdDto obj)
|
{
|
await this.mapViewProjectListContainer1.SelectProject(obj.ID);
|
var vm = new HomeXhsProjectPropertyViewModel(obj);
|
this.homeXhsProjectPropertyCtrl1.SelectedObject = vm;
|
}
|
|
//导入完成事件
|
private void homeXhsProjectTreeListCtrl1_ImportProjectCompletedEvent(ImportXhsProjectViewModel obj)
|
{
|
RefreshData();
|
}
|
|
//跳转事件
|
private async void homeXhsProjectPropertyCtrl1_JumpDirectEvent(XhsProjectStdDto obj)
|
{
|
var bimfacefile = await BimfaceFileStateHelper.IsHaveBimFace(obj.ID);
|
if (bimfacefile == null)
|
{
|
if (!MessageBoxHelper.IsClickOk("当前项目未上传文件,是否前去上传模型文件?"))
|
{
|
var Prjguid = new PageGuid()
|
{
|
Modular = "Xhs",
|
MoudingType = eMoudingType.Tab,
|
Function = "ProjectMgr",
|
};
|
if (!IsExistPage(Prjguid, true))
|
{
|
var page = new XhsProjectMgrPage();
|
CreatePage(page, Prjguid);
|
}
|
}
|
return;
|
}
|
else
|
{
|
var guid = new PageGuid()
|
{
|
Modular = Yw.WinFrmUI.PageModular.Bimface,
|
MoudingType = Yw.WinFrmUI.Page.eMoudingType.Tab,
|
Function = Yw.WinFrmUI.PageFunction.ViewBimface3d,
|
TagName = $"{obj.ID}"
|
};
|
|
if (!IsExistPage(guid, true))
|
{
|
var page = new XhsSchemeMultiMgrPage();
|
await page.SetBindingData(obj.ID);
|
//var page = new XhsProjectSimulationMgrPage();
|
CreatePage(page, guid);
|
}
|
}
|
}
|
|
//刷新数据事件
|
private void homeXhsProjectTreeListCtrl1_RefreshDataEvent()
|
{
|
RefreshData();
|
}
|
|
//单击数量总览跳转
|
private void layoutView1_FieldValueClick(object sender, DevExpress.XtraGrid.Views.Layout.Events.FieldValueClickEventArgs e)
|
{
|
if (e.Column.Caption != "名称")
|
return;
|
switch (e.FieldValue)
|
{
|
case "项目数量":
|
var guid = new PageGuid()
|
{
|
Modular = "Xhs",
|
MoudingType = eMoudingType.Tab,
|
Function = "ProjectMgr",
|
};
|
if (!IsExistPage(guid, true))
|
{
|
var page = new XhsProjectMgrPage();
|
CreatePage(page, guid);
|
}
|
break;
|
|
case "水泵型号数量":
|
var pumpGuid = new PageGuid()
|
{
|
Modular = "Xhs",
|
MoudingType = eMoudingType.Tab,
|
Function = "PumpMgr",
|
};
|
if (!IsExistPage(pumpGuid, true))
|
{
|
var page = new PumpProductMainPanel();
|
CreatePage(page, pumpGuid);
|
}
|
break;
|
|
case "阀门型号数量":
|
break;
|
}
|
}
|
|
private void layoutView1_MouseMove(object sender, MouseEventArgs e)
|
{
|
var info = layoutView1.CalcHitInfo(e.X, e.Y);
|
if (info.Column == null)
|
return;
|
if (info.Column.Caption == "名称")
|
{
|
Cursor.Current = Cursors.Help;
|
}
|
else
|
{
|
}
|
}
|
|
private void layoutView1_MouseEnter(object sender, EventArgs e)
|
{
|
var info = layoutView1.CalcHitInfo(Cursor.Position.X, Cursor.Position.Y);
|
if (info.Column != null && info.Column.Caption == "名称")
|
{
|
Cursor.Current = Cursors.Help;
|
}
|
}
|
|
private void layoutView1_MouseLeave(object sender, EventArgs e)
|
{
|
Cursor.Current = Cursors.Default;
|
}
|
}
|
}
|