duheng
2024-12-19 3af811d30c93995e2500bdd2f3795be77cc1a519
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
using DevExpress.XtraEditors;
using HStation.Vmo;
using Yw.Vmo;
 
namespace HStation.WinFrmUI
{
    public partial class EditAssetsPumpPerform2dDlg : DevExpress.XtraEditors.XtraForm
    {
        public EditAssetsPumpPerform2dDlg()
        {
            InitializeComponent();
            this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
            this.layoutControl1.SetupLayoutControl();
            this.generalOkAndCancelCtrl1.OkEvent += GeneralOkAndCancelCtrl1_OkEvent;
        }
 
        /// <summary>
        ///
        /// </summary>
        public event Func<PhartDiagramRelationExtensionsVmo, Task<bool>> ReloadDataEvent;
 
        private PhartDiagramRelationExtensionsVmo _vmo = null;
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData(PhartDiagramRelationExtensionsVmo vmo)
        {
            if (vmo == null)
            {
                return;
            }
            _vmo = vmo;
            this.pumpChartEditCtrl1.SetBindingData(vmo.Diagram, 0);
        }
 
        //确定
        private async void GeneralOkAndCancelCtrl1_OkEvent()
        {
            if (_vmo == null)
            {
                return;
            }
            var diagram = this.pumpChartEditCtrl1.Get();
            _vmo.Diagram = diagram;
            var result = await this.ReloadDataEvent?.Invoke(_vmo);
            if (!result)
            {
                XtraMessageBox.Show("导入失败!");
                return;
            }
            XtraMessageBox.Show("导入成功!");
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}