using System;
|
using System.ComponentModel;
|
using System.Drawing;
|
|
namespace TProduct.WinFrmUI.Data4Factory
|
{
|
[DefaultEvent("SelectProductPumpListChangedEvent")]
|
public partial class SelectProductPumpListCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public SelectProductPumpListCtrl()
|
{
|
InitializeComponent();
|
}
|
|
public event Action<Model.ProductSeries> SelectedSeriesEvent = null;
|
public event Action<Model.ProductMainExPump> SelectedPumpChanedEvent = null;
|
public Model.ProductSeries SelectSeriesed { get; private set; }
|
public Model.ProductMainExPump SelectPumped { get; private set; }
|
|
private long seriesID = 0;
|
private long pumpID = 0;
|
public void SetBindingData()
|
{
|
this.selProductPumpContentCtrl11.SetBindingData();
|
this.selProductPumpContentCtrl11.SetFocused();
|
}
|
//自定义显示
|
private void popupContainerEdit1_CustomDisplayText(object sender, DevExpress.XtraEditors.Controls.CustomDisplayTextEventArgs e)
|
{
|
this.popupContainerControl1.Size = new Size(400, 400);
|
if (pumpID < 1 && seriesID < 0)
|
{
|
var Model = e?.Value as Model.ProductSeries;
|
e.DisplayText = Model?.Name;
|
}
|
else
|
{
|
if (pumpID < 1 && seriesID > 0)
|
{
|
var Model = e?.Value as Model.ProductSeries;
|
e.DisplayText = Model?.Name;
|
}
|
if (seriesID < 1 && pumpID > 0)
|
{
|
var Model = e?.Value as Model.ProductMainExPump;
|
e.DisplayText = Model?.Name;
|
}
|
}
|
}
|
|
private void ProductMainExPumpCtrl1_CheckedChanedEvent(Model.ProductMainExPump obj)
|
{
|
pumpID = obj.ID;
|
seriesID = 0;
|
this.popupContainerEdit1.ClosePopup();
|
if (SelectPumped != null)
|
{
|
if (SelectPumped.ID == obj.ID)
|
return;
|
}
|
SelectPumped = obj;
|
this.popupContainerEdit1.EditValue = SelectPumped;
|
this.SelectedPumpChanedEvent?.Invoke(SelectPumped);
|
|
}
|
|
private void ProductSeriesCtrl1_CheckedChanedEvent(Model.ProductSeries obj)
|
{
|
seriesID = obj.ID;
|
pumpID = 0;
|
this.popupContainerEdit1.ClosePopup();
|
if (SelectSeriesed != null)
|
{
|
if (SelectSeriesed.ID == obj.ID)
|
return;
|
}
|
SelectSeriesed = obj;
|
this.popupContainerEdit1.EditValue = SelectSeriesed;
|
this.SelectedSeriesEvent?.Invoke(SelectSeriesed);
|
|
}
|
}
|
}
|