using DevExpress.XtraEditors;
|
using System.Collections.Generic;
|
using System.Linq;
|
|
namespace TProduct.WinFrmUI.TestBench
|
{
|
public partial class ListWorkBenchMonitorPointDlg : DevExpress.XtraEditors.XtraForm
|
{
|
public ListWorkBenchMonitorPointDlg()
|
{
|
InitializeComponent();
|
this.gridView1.SetNormalView();
|
this.gridView1.SetGridMianViewColor();
|
}
|
|
private Model.WorkBenchBase _paras;
|
public class CurrentViewModel : Model.WorkBenchMonitorPoint
|
{
|
public CurrentViewModel(Model.WorkBenchMonitorPoint rhs) : base(rhs)
|
{
|
|
}
|
|
public string PortName { get; set; }
|
}
|
private List<CurrentViewModel> _bindList = null;
|
|
/// <summary>
|
/// 初始化
|
/// </summary>
|
/// <param name="paras"></param>
|
public void SetBindingData(Model.WorkBenchBase bench)
|
{
|
_paras = bench;
|
if (_paras == null)
|
return;
|
WaitFrmHelper.ShowWaitForm();
|
var mpList = new BLL.WorkBenchMonitorPoint().GetByBenchID(_paras.ID);
|
if (mpList == null || mpList.Count() == 0)
|
{
|
WaitFrmHelper.HideWaitForm(); return;
|
}
|
|
_bindList = new List<CurrentViewModel>();
|
foreach (var mp in mpList)
|
{
|
_bindList.Add(new CurrentViewModel(mp));
|
}
|
if (bench.LinkType == Model.eLinkType.ShunZhou)
|
{
|
var bundleInfo = new BLL.WorkBenchInstrumentShun().GetShunBundle(bench);
|
|
}
|
this.bindingSource1.DataSource = _bindList;
|
this.bindingSource1.ResetBindings(false);
|
WaitFrmHelper.HideWaitForm();
|
}
|
|
|
private void barBtnView_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
if (_bindList == null)
|
return;
|
var row = this.gridView1.GetCurrentViewModel(_bindList);
|
if (row == null)
|
{
|
XtraMessageBox.Show("未选择数据!");
|
return;
|
}
|
WaitFrmHelper.ShowWaitForm();
|
var dlg = new SetSingleBenchMonitorPointInfoDlg();
|
dlg.Shown += delegate { WaitFrmHelper.HideWaitForm(); };
|
dlg.SetBindingData(row);
|
dlg.ReloadDataEvent += rhs =>
|
{
|
row.Reset(rhs);
|
this.gridView1.RefreshData();
|
};
|
dlg.ShowDialog();
|
}
|
}
|
}
|