tx
2025-04-09 fa7510e1ed63df0366787fa4ed1b3db6426d2b46
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
84
85
86
using System;
using System.ComponentModel;
using System.Drawing;
 
namespace TProduct.WinFrmUI.Data4Factory
{
    [DefaultEvent("SelectProductValveListChangedEvent")]
    public partial class SelectProductValveListCtrl : DevExpress.XtraEditors.XtraUserControl
    {
        public SelectProductValveListCtrl()
        {
            InitializeComponent();
 
            this.selProductValveContentListCtrl1.SelectProductSeriesEvent += ProductSeriesCtrl1_CheckedChanedEvent;
            this.selProductValveContentListCtrl1.SelectProductValveEvent += ProductMainExValveCtrl1_CheckedChanedEvent;
        }
        public event Action<Model.ProductSeries> SelectedSeriesEvent = null;
        public event Action<Model.ProductMainExValve> SelectedValveChanedEvent = null;
        public Model.ProductSeries SelectSeriesed { get; private set; }
        public Model.ProductMainExValve SelectValveed { get; private set; }
 
        private long seriesID = 0;
        private long ValveID = 0;
        public string Selected { get; private set; }
        public void SetBindingData()
        {
            this.selProductValveContentListCtrl1.SetBindingData();
            this.selProductValveContentListCtrl1.SetFocused();
        }
        //自定义显示
        private void popupContainerEdit1_CustomDisplayText(object sender, DevExpress.XtraEditors.Controls.CustomDisplayTextEventArgs e)
        {
            this.popupContainerControl1.Size = new Size(400, 400);
            if (ValveID < 1 && seriesID < 0)
            {
                var Model = e?.Value as Model.ProductSeries;
                e.DisplayText = Model?.Name;
            }
            else
            {
                if (ValveID < 1 && seriesID > 0)
                {
                    var Model = e?.Value as Model.ProductSeries;
                    e.DisplayText = Model?.Name;
                }
                if (seriesID < 1 && ValveID > 0)
                {
                    var Model = e?.Value as Model.ProductMainExValve;
                    e.DisplayText = Model?.Name;
                }
            }
        }
 
        private void ProductMainExValveCtrl1_CheckedChanedEvent(Model.ProductMainExValve obj)
        {
            ValveID = obj.ID;
            seriesID = 0;
            this.popupContainerEdit1.ClosePopup();
            if (SelectValveed != null)
            {
                if (SelectValveed.ID == obj.ID)
                    return;
            }
            SelectValveed = obj;
            this.popupContainerEdit1.EditValue = SelectValveed;
            this.SelectedValveChanedEvent?.Invoke(SelectValveed);
 
        }
 
        private void ProductSeriesCtrl1_CheckedChanedEvent(Model.ProductSeries obj)
        {
            seriesID = obj.ID;
            ValveID = 0;
            this.popupContainerEdit1.ClosePopup();
            if (SelectSeriesed != null)
            {
                if (SelectSeriesed.ID == obj.ID)
                    return;
            }
            SelectSeriesed = obj;
            this.popupContainerEdit1.EditValue = SelectSeriesed;
            this.SelectedSeriesEvent?.Invoke(SelectSeriesed);
 
        }
    }
}