duheng
2024-12-20 ab65b0ac21e7fabfd8548538142d9a1b66a2ad3d
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
using DevExpress.Mvvm.POCO;
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.Forms;
 
namespace HStation.WinFrmUI
{
    public partial class AssetsCompressorSingleMatchingDlg : DevExpress.XtraEditors.XtraForm
    {
        public AssetsCompressorSingleMatchingDlg()
        {
            InitializeComponent();
            this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
            this.generalOkAndCancelCtrl1.OkEvent += GeneralOkAndCancelCtrl1_OkEvent;
        }
 
        public event Action<HydroCompressorMatchingViewModel> ReloadDataEvent;
 
        private HydroCompressorMatchingViewModel _input = null;
 
        /// <summary>
        /// 
        /// </summary>
        public void SetBindingData(HydroCompressorMatchingViewModel input)
        {
            if (input == null)
            {
                return;
            }
            _input = input;
            this.assetsCompressorSingleMatchingCtrl1.SetBindingData(input.DbId);
        }
 
        private void GeneralOkAndCancelCtrl1_OkEvent()
        {
            if (_input == null)
            {
                return;
            }
            var vm = this.assetsCompressorSingleMatchingCtrl1.Get();
            if (vm == null)
            {
                return;
            }
 
            _input.MatchingModelType = vm.Name;
            _input.MatchingMaterial = vm.Material;
            _input.MatchingDiameter = vm.Diameter;
            _input.MinorLoss = vm.MinorLoss;
            this.ReloadDataEvent?.Invoke(_input);
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
 
    }
}