using HStation.WinFrmUI.Core;
|
|
namespace HStation.WinFrmUI.Xhs.Core
|
{
|
public partial class HomePageMainPanel : DocumentPage
|
{
|
public HomePageMainPanel()
|
{
|
InitializeComponent();
|
this.xhsProjectTreeList1.SelectProject += XhsProjectTreeList1_SelectProjectAsync;
|
}
|
|
private BLL.XhsProject _bll = null;
|
|
/// <summary>
|
/// 初始化数据
|
/// </summary>
|
public override void InitialDataSource()
|
{
|
_bll = new BLL.XhsProject();
|
this.xhsProjectTreeList1.SetBindingData();
|
SetBindingData();
|
}
|
|
private async void SetBindingData()
|
{
|
this.mapViewProjectListContainer1.LoadCompletedEvent += MapViewProjectListContainer1_LoadCompletedEvent;
|
await this.mapViewProjectListContainer1.InitialContainer();
|
}
|
|
//聚焦地图切换事件
|
private async void XhsProjectTreeList1_SelectProjectAsync(string PrjID)
|
{
|
await mapViewProjectListContainer1.SelectProject(PrjID);
|
var selectchage = await _bll.GetByID(Convert.ToInt64(PrjID));
|
if (selectchage != null)
|
{
|
propertyGridControl1.SelectedObject = new XhsProjectViewModel(selectchage);
|
}
|
}
|
|
//初始化地图撒点
|
private async void MapViewProjectListContainer1_LoadCompletedEvent()
|
{
|
var list = new List<MapProjectViewModel>();
|
var alllist = await _bll.GetAll();
|
foreach (var item in alllist)
|
{
|
var postionchar = item.MapPosition.Split(',');
|
list.Add(new MapProjectViewModel() { Id = item.ID.ToString(), Name = item.Name, Description = item.Description, Point = new Yw.Model.Map.Point(Convert.ToDouble(postionchar[0]), Convert.ToDouble(postionchar[1])) });
|
}
|
await mapViewProjectListContainer1.SetProjectList(list);
|
}
|
}
|
}
|