namespace HStation.WinFrmUI
|
{
|
public partial class XhsSchemePumpChangeListCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public XhsSchemePumpChangeListCtrl()
|
{
|
InitializeComponent();
|
this.layoutView1.SetDefuaulView();
|
this.layoutView1.SetFindPanel();
|
}
|
|
/// <summary>
|
/// 水力查看事件
|
/// </summary>
|
public event Action<string> HydroViewEvent;
|
|
/// <summary>
|
/// 水力改变事件
|
/// </summary>
|
public event Action<HydroPumpViewModel> HydroChangeEvent;
|
|
|
private BindingList<XhsSchemePumpChangeViewModel> _allBindingList = null;//所有绑定列表
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo)
|
{
|
_allBindingList = new BindingList<XhsSchemePumpChangeViewModel>();
|
if (hydroInfo != null)
|
{
|
if (hydroInfo.Pumps != null && hydroInfo.Pumps.Count > 0)
|
{
|
foreach (var blunthead in hydroInfo.Pumps)
|
{
|
var vm = new HydroPumpViewModel(blunthead, hydroInfo);
|
var viewModel = new XhsSchemePumpChangeViewModel(vm);
|
viewModel.ViewImage = this.svgImg32[0];
|
_allBindingList.Add(viewModel);
|
}
|
}
|
}
|
this.xhsSchemePumpChangeViewModelBindingSource.DataSource = _allBindingList;
|
this.xhsSchemePumpChangeViewModelBindingSource.ResetBindings(false);
|
}
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData(List<HydroVisualViewModel> allVisualViewModelList)
|
{
|
_allBindingList = new BindingList<XhsSchemePumpChangeViewModel>();
|
if (allVisualViewModelList != null && allVisualViewModelList.Count > 0)
|
{
|
foreach (var visualViewModel in allVisualViewModelList)
|
{
|
if (visualViewModel.Vmo.Catalog == Yw.Hydro.ParterCatalog.Pump)
|
{
|
var vm = visualViewModel as HydroPumpViewModel;
|
if (vm != null)
|
{
|
var viewModel = new XhsSchemePumpChangeViewModel(vm);
|
viewModel.ViewImage = this.svgImg32[0];
|
_allBindingList.Add(viewModel);
|
}
|
}
|
}
|
}
|
this.xhsSchemePumpChangeViewModelBindingSource.DataSource = _allBindingList;
|
this.xhsSchemePumpChangeViewModelBindingSource.ResetBindings(false);
|
}
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData(List<HydroPumpViewModel> allPumpViewModelList)
|
{
|
_allBindingList = new BindingList<XhsSchemePumpChangeViewModel>();
|
if (allPumpViewModelList != null && allPumpViewModelList.Count > 0)
|
{
|
foreach (var fourlinkViewModel in allPumpViewModelList)
|
{
|
var viewModel = new XhsSchemePumpChangeViewModel(fourlinkViewModel);
|
viewModel.ViewImage = this.svgImg32[0];
|
_allBindingList.Add(viewModel);
|
}
|
}
|
this.xhsSchemePumpChangeViewModelBindingSource.DataSource = _allBindingList;
|
this.xhsSchemePumpChangeViewModelBindingSource.ResetBindings(false);
|
}
|
|
/// <summary>
|
/// 设置聚焦行
|
/// </summary>
|
public void SetFocusedRow(int rowHandle)
|
{
|
this.layoutView1.FocusedRowHandle = rowHandle;
|
}
|
|
//初始化状态
|
private void InitialRunStatus()
|
{
|
this.repImgCmbStatus.BeginUpdate();
|
this.repImgCmbStatus.Items.Clear();
|
this.repImgCmbStatus.Items.Add("开启", "开启", -1);
|
this.repImgCmbStatus.Items.Add("关闭", "关闭", -1);
|
this.repImgCmbStatus.EndUpdate();
|
}
|
|
//字段点击
|
private void layoutView1_FieldValueClick(object sender, DevExpress.XtraGrid.Views.Layout.Events.FieldValueClickEventArgs e)
|
{
|
var row = this.layoutView1.GetRow(e.RowHandle) as XhsSchemePumpChangeViewModel;
|
if (row == null)
|
{
|
return;
|
}
|
if (e.Column == this.colSvgImage)
|
{
|
var input = Yw.WinFrmUI.HydroMatchingHelper.Create(row.ViewModel.Vmo, row.ViewModel.HydroInfo);
|
var dlg = new SimulationPumpSingleMatchingDlg();
|
dlg.ReloadDataEvent += (output) =>
|
{
|
if (Yw.WinFrmUI.HydroMatchingHelper.Apply(row.ViewModel, output))
|
{
|
this.layoutView1.RefreshRow(e.RowHandle);
|
this.HydroChangeEvent?.Invoke(row.ViewModel);
|
}
|
};
|
dlg.SetBindingData(input);
|
dlg.ShowDialog();
|
}
|
else if (e.Column == this.colViewImage)
|
{
|
this.HydroViewEvent?.Invoke(row.ViewModel.Vmo.Code);
|
}
|
}
|
|
//卡片点击
|
private void layoutView1_CardClick(object sender, DevExpress.XtraGrid.Views.Layout.Events.CardClickEventArgs e)
|
{
|
var row = this.layoutView1.GetRow(e.RowHandle) as XhsSchemePumpChangeViewModel;
|
if (row == null)
|
{
|
return;
|
}
|
}
|
|
//选中列变换
|
private void layoutView1_FocusedColumnChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedColumnChangedEventArgs e)
|
{
|
|
}
|
|
//单元格值变换
|
private void layoutView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
|
{
|
var row = this.layoutView1.GetRow(e.RowHandle) as XhsSchemePumpChangeViewModel;
|
if (row == null)
|
{
|
return;
|
}
|
row.ViewModel.UpdateVmoProperty();
|
this.HydroChangeEvent?.Invoke(row.ViewModel);
|
}
|
|
private void toolTipController1_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e)
|
{
|
// 获取当前鼠标所在的单元格信息
|
//var hitInfo = this.layoutView1.CalcHitInfo(e.ControlMousePosition);
|
//if (hitInfo != null && hitInfo.RowHandle >= 0 && hitInfo.Column != null)
|
//{
|
// if (hitInfo.Column == this.colSvgImage)
|
// {
|
// e.Info = new DevExpress.Utils.ToolTipControlInfo(this.gridControl1, "从产品中选择");
|
// }
|
// else if (hitInfo.Column == this.colName)
|
// {
|
// e.Info = new DevExpress.Utils.ToolTipControlInfo(this.gridControl1, "名称");
|
// }
|
// else if (hitInfo.Column == this.colViewImage)
|
// {
|
// e.Info = new DevExpress.Utils.ToolTipControlInfo(this.gridControl1, "模型定位");
|
// }
|
// else if (hitInfo.Column == this.colMaterial)
|
// {
|
// e.Info = new DevExpress.Utils.ToolTipControlInfo(this.gridControl1, "材质");
|
// }
|
// else if (hitInfo.Column == this.colCaliber)
|
// {
|
// e.Info = new DevExpress.Utils.ToolTipControlInfo(this.gridControl1, "口径(mm)");
|
// }
|
// else if (hitInfo.Column == this.colRunningThroughLoss)
|
// {
|
// e.Info = new DevExpress.Utils.ToolTipControlInfo(this.gridControl1, "主管通过损失系数");
|
// }
|
// else if (hitInfo.Column == this.colBranchThroughLoss)
|
// {
|
// e.Info = new DevExpress.Utils.ToolTipControlInfo(this.gridControl1, "支管通过损失系数");
|
// }
|
// else
|
// {
|
// //e.Info = null;
|
// }
|
// return;
|
//}
|
//else
|
//{
|
// //e.Info = null;
|
//}
|
|
}
|
|
|
}
|
}
|