using DevExpress.Utils.Svg;
|
using Mapster;
|
using Yw;
|
|
namespace HStation.WinFrmUI
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public partial class CreateXhsSchemePipeChangePage : DevExpress.XtraEditors.XtraUserControl, Yw.WinFrmUI.IWizardPageAsync<CreateXhsSchemeViewModel>
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public CreateXhsSchemePipeChangePage()
|
{
|
InitializeComponent();
|
this.xhsSchemePipeChangeListCtrl1.HydroViewEvent += XhsSchemePipeChangeListCtrl1_HydroViewEvent;
|
this.xhsSchemePipeChangeListCtrl1.HydroChangeEvent += XhsSchemePipeChangeListCtrl1_HydroChangeEvent;
|
}
|
|
/// <summary>
|
/// 页面状态改变事件
|
/// </summary>
|
public event Action PageStateChangedEvent;
|
|
private CreateXhsSchemeViewModel _vm = null;//操作对象
|
private List<HydroPipeViewModel> _allViewModelList = null;//所有视图列表
|
|
/// <summary>
|
/// 初始化
|
/// </summary>
|
public void InitialPage(CreateXhsSchemeViewModel vm)
|
{
|
if (vm == null)
|
{
|
return;
|
}
|
_vm = vm;
|
_allViewModelList = new List<HydroPipeViewModel>();
|
if (vm.HydroInfo.Pipes != null && vm.HydroInfo.Pipes.Count > 0)
|
{
|
foreach (var visualViewModel in vm.AllVisualViewModelList)
|
{
|
if (visualViewModel.Vmo.Catalog == Yw.Hydro.ParterCatalog.Pipe)
|
{
|
var vmPipe = visualViewModel as HydroPipeViewModel;
|
if (vmPipe != null)
|
{
|
_allViewModelList.Add(vmPipe);
|
}
|
}
|
}
|
}
|
|
ShowBimfaceCtrl();
|
this.xhsSchemePipeChangeListCtrl1.SetBindingData(_allViewModelList);
|
this.PageStateChangedEvent?.Invoke();
|
}
|
|
#region Bimface
|
|
//bimface控件
|
private CreateXhsSchemeBimfaceCtrl _bimfaceCtrl = null;
|
|
//获取 bimface 控件
|
private async Task<CreateXhsSchemeBimfaceCtrl> GetBimfaceCtrl()
|
{
|
if (_vm == null)
|
{
|
return default;
|
}
|
if (_bimfaceCtrl == null)
|
{
|
_bimfaceCtrl = new CreateXhsSchemeBimfaceCtrl();
|
_bimfaceCtrl.Dock = DockStyle.Fill;
|
await _bimfaceCtrl.InitialData(_vm.Project, _vm.ProjectSite, _vm.HydroInfo, _vm.AllVisualViewModelList);
|
_bimfaceCtrl.HydroMouseLeftClickEvent += (code) =>
|
{
|
if (_allViewModelList == null || _allViewModelList.Count < 1)
|
{
|
return;
|
}
|
var index = _allViewModelList.FindIndex(x => x.Vmo.Code == code);
|
this.xhsSchemePipeChangeListCtrl1.SetFocusedRow(index);
|
};
|
_bimfaceCtrl.SelectVisualEvent += (code) =>
|
{
|
if (_allViewModelList == null || _allViewModelList.Count < 1)
|
{
|
return;
|
}
|
var index = _allViewModelList.FindIndex(x => x.Vmo.Code == code);
|
this.xhsSchemePipeChangeListCtrl1.SetFocusedRow(index);
|
};
|
}
|
return _bimfaceCtrl;
|
}
|
|
//显示 bimface 控件
|
private async void ShowBimfaceCtrl()
|
{
|
var bimfaceCtrl = await GetBimfaceCtrl();
|
this.panelControl1.Controls.Clear();
|
this.panelControl1.Controls.Add(bimfaceCtrl);
|
}
|
|
|
|
#endregion
|
|
|
/// <summary>
|
/// 允许上一步
|
/// </summary>
|
public bool AllowPrev
|
{
|
get { return true; }
|
}
|
|
/// <summary>
|
/// 允许下一步
|
/// </summary>
|
public bool AllowNext
|
{
|
get { return true; }
|
}
|
|
/// <summary>
|
/// 允许取消
|
/// </summary>
|
public bool AllowCancel
|
{
|
get { return true; }
|
}
|
|
/// <summary>
|
/// 允许完成
|
/// </summary>
|
public bool AllowComplete
|
{
|
get { return false; }
|
}
|
|
/// <summary>
|
/// 能否上一步
|
/// </summary>
|
public Task<bool> CanPrev()
|
{
|
return Task.Run(() => true);
|
}
|
|
/// <summary>
|
/// 能否下一步
|
/// </summary>
|
public Task<bool> CanNext()
|
{
|
return Task.Run(() => true);
|
}
|
|
/// <summary>
|
/// 能否关闭
|
/// </summary>
|
public Task<bool> CanCancel()
|
{
|
return Task.Run(() => true);
|
}
|
|
/// <summary>
|
/// 能否完成
|
/// </summary>
|
public Task<bool> CanComplete()
|
{
|
return Task.Run(() => false);
|
}
|
|
//改变
|
private void XhsSchemePipeChangeListCtrl1_HydroChangeEvent(HydroPipeViewModel obj)
|
{
|
if (_vm == null)
|
{
|
return;
|
}
|
if (_vm.allChangeRecordList == null)
|
{
|
_vm.allChangeRecordList = new List<XhsSchemeChangeRecordViewModel>();
|
}
|
_vm.allChangeRecordList.Update(obj);
|
}
|
|
//定位
|
private void XhsSchemePipeChangeListCtrl1_HydroViewEvent(string obj)
|
{
|
if (string.IsNullOrEmpty(obj))
|
{
|
return;
|
}
|
if (_vm == null)
|
{
|
return;
|
}
|
_bimfaceCtrl?.ZoomAndSelectComponent(obj);
|
}
|
|
|
}
|
}
|