lixiaojun
2024-10-29 1d8832e8e8e862a296f80c18ae2f1dac40419b68
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
namespace HStation.WinFrmUI
{
    public partial class XhsProjectSimulationValveCalcuPrefixCtrl : DevExpress.XtraEditors.XtraUserControl, IXhsProjectSimulationCalcuPrefix
    {
        public XhsProjectSimulationValveCalcuPrefixCtrl()
        {
            InitializeComponent();
            this.gridView1.SetNormalView(30);
            this.gridView1.RegistCustomDrawRowIndicator(40);
        }
 
        /// <summary>
        /// 水力点击事件
        /// </summary>
        public event Action<Yw.Model.HydroParterInfo> HydroClickEvent;
 
        /// <summary>
        /// 显示查询面板
        /// </summary>
        [Browsable(true)]
        [Description("显示查询面板")]
        [DefaultValue(true)]
        public bool ShowFindPanel
        {
            get { return this.gridView1.OptionsFind.AlwaysVisible; }
            set { this.gridView1.OptionsFind.AlwaysVisible = value; }
        }
 
        /// <summary>
        /// 是否拥有水利列表
        /// </summary>
        public bool HasHydroList
        {
            get { return _allBindingList != null && _allBindingList.Count > 0; }
        }
 
        //绑定列表
        private List<XhsProjectSimulationValveCalcuPrefixViewModel> _allBindingList = null;
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo)
        {
            _allBindingList = new List<XhsProjectSimulationValveCalcuPrefixViewModel>();
            hydroInfo?.Valves?.ForEach(x =>
            {
                var vm = new XhsProjectSimulationValveCalcuPrefixViewModel(x);
                _allBindingList.Add(vm);
            });
            this.xhsProjectSimulationValveCalcuPrefixViewModelBindingSource.DataSource = _allBindingList;
            this.xhsProjectSimulationValveCalcuPrefixViewModelBindingSource.ResetBindings(false);
        }
 
        //行单元点击
        private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            var row = this.gridView1.GetRow(e.RowHandle) as XhsProjectSimulationValveCalcuPrefixViewModel;
            if (row == null)
            {
                return;
            }
            this.HydroClickEvent?.Invoke(row.Vmo);
        }
 
 
    }
}