duheng
2025-01-17 89b928115c2309c6548b096b4d71c0dedbcaa2db
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
using Yw;
using Yw.Vmo;
 
namespace HStation.WinFrmUI
{
    public partial class EditAssetsValveCurveDlg : DevExpress.XtraEditors.XtraForm
    {
        public EditAssetsValveCurveDlg()
        {
            InitializeComponent();
            this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
            this.layoutControl1.SetupLayoutControl();
            this.generalOkAndCancelCtrl1.OkEvent += GeneralOkAndCancelCtrl1_OkEvent;
        }
 
        /// <summary>
        ///
        /// </summary>
        public event Action<PhartDiagramExGraphListVmo> ReloadDataEvent;
 
        private PhartDiagramExGraphListVmo _vmo = null;
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData(PhartDiagramExGraphListVmo vmo)
        {
            if (vmo == null)
            {
                return;
            }
            _vmo = vmo;
            this.valveChartEditCtrl1.SetBindingData(vmo);
        }
 
        //确定
        private async void GeneralOkAndCancelCtrl1_OkEvent()
        {
            if (_vmo == null)
            {
                return;
            }
            var diagram = this.valveChartEditCtrl1.Get();
            var bol = await BLLFactory<Yw.BLL.PhartDiagramExtensions>.Instance.Update(diagram);
            if (!bol)
            {
                TipFormHelper.ShowError("更新失败!");
                return;
            }
            var vmo = await BLLFactory<Yw.BLL.PhartDiagramExtensions>.Instance.GetByID(diagram.ID);
            this.ReloadDataEvent?.Invoke(vmo);
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}