lixiaojun
2024-11-14 ae45d123c2ee907fd40f7db86f2aac2b21f976b6
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
namespace Yw.WinFrmUI
{
    public partial class SetHydroWaterboxWorkingInfoCtrl : DevExpress.XtraEditors.XtraUserControl, ISetHydroVisualWorkingInfoCtrl
    {
        public SetHydroWaterboxWorkingInfoCtrl()
        {
            InitializeComponent();
            this.layoutControl1.SetupLayoutControl();
        }
        //200,80
 
        /// <summary>
        /// 查看组件事件
        /// </summary>
        public event Action<Yw.Model.HydroVisualInfo> HydroViewEvent;
 
        private Yw.Model.HydroVisualInfo _visual = null;//构件
        private HydroWaterboxWorkingInfoViewModel _workingInfo = null;//工况信息
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData(Yw.Model.HydroVisualInfo parter)
        {
            var waterbox = parter as Yw.Model.HydroWaterboxInfo;
            if (waterbox == null)
            {
                return;
            }
            _visual = waterbox;
            this.layoutGroupCaption.Text = HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Waterbox);
            if (!string.IsNullOrEmpty(parter.Name))
            {
                this.layoutGroupCaption.Text = parter.Name;
            }
            _workingInfo = new HydroWaterboxWorkingInfoViewModel(waterbox);
            UpdateBindingData(_workingInfo);
        }
 
        /// <summary>
        /// 更新绑定
        /// </summary>
        public void UpdateBindingData(HydroVisualWorkingInfoViewModel workingInfo)
        {
            if (_visual == null)
            {
                return;
            }
            _workingInfo = workingInfo as HydroWaterboxWorkingInfoViewModel;
            if (_workingInfo == null)
            {
                return;
            }
            this.txtInitLevel.EditValue = _workingInfo.InitLevel;
        }
 
        /// <summary>
        /// 获取工况
        /// </summary>
        public HydroVisualWorkingInfoViewModel GetWorkingInfo()
        {
            if (_workingInfo == null)
            {
                return default;
            }
            _workingInfo.InitLevel = double.Parse(this.txtInitLevel.EditValue.ToString());
            return _workingInfo;
        }
 
 
        //查看组件
        private void layoutGroupCaption_CustomButtonClick(object sender, DevExpress.XtraBars.Docking2010.BaseButtonEventArgs e)
        {
            if (_visual == null)
            {
                return;
            }
            this.HydroViewEvent?.Invoke(_visual);
        }
 
 
    }
}