duheng
2025-01-08 21067008153a810c72e8b86faaeca577290ff265
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
namespace HStation.WinFrmUI
{
    public partial class AssetsHydrantSingleMatchingDlg : DevExpress.XtraEditors.XtraForm
    {
        public AssetsHydrantSingleMatchingDlg()
        {
            InitializeComponent();
            this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
            this.generalOkAndCancelCtrl1.OkEvent += GeneralOkAndCancelCtrl1_OkEvent;
        }
 
        public event Action<HydroHydrantMatchingViewModel> ReloadDataEvent;
 
        private HydroHydrantMatchingViewModel _input = null;
 
        /// <summary>
        ///
        /// </summary>
        public void SetBindingData(HydroHydrantMatchingViewModel input)
        {
            if (input == null)
            {
                return;
            }
            _input = input;
            this.assetsHydrantSingleMatchingCtrl1.SetBindingData(input.DbId);
        }
 
        private void GeneralOkAndCancelCtrl1_OkEvent()
        {
            if (_input == null)
            {
                return;
            }
            var vm = this.assetsHydrantSingleMatchingCtrl1.Get();
            if (vm == null)
            {
                return;
            }
            _input.MatchingDbId = vm.ID.ToString();
            _input.MatchingModelType = vm.Name;
            _input.MatchingMaterial = vm.Material;
            _input.MatchingCaliber = vm.Caliber;
            _input.MatchingMinorLoss = vm.MinorLoss;
            this.ReloadDataEvent?.Invoke(_input);
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}