tx
2025-04-09 fa7510e1ed63df0366787fa4ed1b3db6426d2b46
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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();
        }
    }
}