lixiaojun
2024-10-18 217756094e1f22763edf2b18d3723403786c82fc
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
using DevExpress.Utils.Layout;
using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Forms;
using Yw.WinFrmUI;
 
namespace Yw.WinFrmUI
{
    public partial class SetWaterboxCalcuPrefixListCtrl : DevExpress.XtraEditors.XtraUserControl, Yw.WinFrmUI.IWizardPage<SetHydroCalcuPrefixViewModel>
    {
        public SetWaterboxCalcuPrefixListCtrl()
        {
            InitializeComponent();
        }
 
        /// <summary>
        /// 页面状态发生改变
        /// </summary>
        public event Action PageStateChangedEvent;
 
        private SetHydroCalcuPrefixViewModel _vm = null;
        private List<SetWaterboxCalcuPrefixCtrl> _allCalcuPrefixCtrlList = null;
 
        /// <summary>
        /// 初始化页面
        /// </summary>
        public void InitialPage(SetHydroCalcuPrefixViewModel vm)
        {
            _vm = vm;
            InitialControls();
        }
 
        //初始化控件
        private void InitialControls()
        {
            if (_vm == null)
            {
                return;
            }
            if (_allCalcuPrefixCtrlList == null)
            {
                _allCalcuPrefixCtrlList = new List<SetWaterboxCalcuPrefixCtrl>();
                this.tabPanelCore.Columns.Add(new TablePanelColumn(TablePanelEntityStyle.Relative, 55F));
                if (_vm.HydroInfo.Waterboxs != null && _vm.HydroInfo.Waterboxs.Count > 0)
                {
                    for (int i = 0; i < _vm.HydroInfo.Waterboxs.Count; i++)
                    {
                        this.tabPanelCore.Rows.Add(new TablePanelRow(TablePanelEntityStyle.AutoSize, 150F));
                        var ctrl = new SetWaterboxCalcuPrefixCtrl();
                        // ctrl.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                        ctrl.SetBindingData(_vm.HydroInfo.Waterboxs[i]);
                        //ctrl.Size = new Size();
                        this.tabPanelCore.Controls.Add(ctrl);
                        this.tabPanelCore.SetCell(ctrl, i, 0);
                    }
                    this.tabPanelCore.Rows.Add(new TablePanelRow(TablePanelEntityStyle.AutoSize, 150F));
                }
            }
        }
 
        //允许上一步
        public bool AllowPrev
        {
            get
            {
                if (_vm == null)
                {
                    return false;
                }
                if (_vm.FirstPage == this)
                {
                    return false;
                }
                return true;
            }
        }
 
        //允许上一步
        public bool AllowNext
        {
            get
            {
                if (_vm == null)
                {
                    return false;
                }
                if (_vm.LastPage == this)
                {
                    return false;
                }
                return true;
            }
        }
 
        //允许取消
        public bool AllowCancel
        {
            get { return true; }
        }
 
        //允许完成
        public bool AllowComplete
        {
            get { return true; }
        }
 
        public bool CanPrev()
        {
            return true;
        }
 
        public bool CanNext()
        {
            return true;
        }
 
        public bool CanCancel()
        {
            return true;
        }
 
        public bool CanComplete()
        {
            return true;
        }
 
 
    }
}