lixiaojun
2024-12-09 725f20b576bdd40d57d9a1e806ce3f6f39181a84
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
namespace HStation.WinFrmUI
{
    public partial class XhsProjectSimulationValveMatchingListCtrl : DevExpress.XtraEditors.XtraUserControl
    {
        public XhsProjectSimulationValveMatchingListCtrl()
        {
            InitializeComponent();
            this.gridView1.SetNormalView(30);
            this.gridView1.OptionsView.ShowDetailButtons = true;
            this.gridView1.OptionsView.ShowGroupPanel = false;
        }
 
        private List<XhsProjectSimulationValveMatchingViewModel> _allBindingList = new List<XhsProjectSimulationValveMatchingViewModel>();
 
        /// <summary>
        /// 点击事件
        /// </summary>
        public event Action<string> RowClickEvent;
 
        public void SetBindingData(List<ValveMatchingViewModel> valveMatchingViewModels)
        {
            if (valveMatchingViewModels != null)
            {
                foreach (var item in valveMatchingViewModels)
                {
                    _allBindingList.Add(new XhsProjectSimulationValveMatchingViewModel(item));
                }
                this.valveFormViewModelBindingSource.DataSource = _allBindingList;
            }
        }
 
        public List<ValveMatchingViewModel> SetMatching(List<ValveMatchingViewModel> inputs, List<AssetsValveMainVmo> alllist)
        {
            if (inputs == null)
                return null;
            foreach (var item in inputs)
            {
                AssetsMatchingHelper.MatchingValve(item, alllist);
            }
            _allBindingList.Clear();
            foreach (var item in inputs)
            {
                _allBindingList.Add(new XhsProjectSimulationValveMatchingViewModel(item));
            }
            this.valveFormViewModelBindingSource.ResetBindings(false);
            return inputs;
        }
 
        //行点击事件
        private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            var row = this.gridView1.GetCurrentViewModel(_allBindingList);
            if (row == null)
            {
                return;
            }
            this.RowClickEvent?.Invoke(row.Code);
        }
    }
}