陈嘉乐
2021-02-24 6031a2d7faaa4f0271b0e9cecaa228e411ceca11
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
using System;
using HDL_ON.UI.UI2.Intelligence.Automation.LogicView;
using Shared;
using System.Collections.Generic;
using System.Text;
namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
{
    public class AddControl:FrameLayout
    {
        public AddControl()
        {
        }
 
        public void Show() {
 
            #region 界面布局
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
            PirDevice.View.TopView topView = new View.TopView();
            topView.topNameBtn.TextID = StringId.zhinengyaokongqi;
            topView.topIconBtn.Visible = true;
            topView.topIconBtn.UnSelectedImagePath = "PirIcon/del.png";
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); };
            #region 添加按钮
            FrameLayout addLayout = new FrameLayout
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(84),
                Width = Application.GetRealWidth(TextSize.view375),
            };
            this.AddChidren(addLayout);
 
            Button addBtn = new Button
            {
                Width = Application.GetRealWidth(344),
                Height = Application.GetRealHeight(44),
                Y = Application.GetRealHeight(24),
                X = Application.GetRealWidth(16),
                TextID = StringId.tianjiaanniu,
                TextSize = TextSize.text16,
                TextColor = CSS.CSS_Color.btnSaveBackgroundColor,
                BorderColor = CSS.CSS_Color.btnSaveBackgroundColor,
                BorderWidth = 1,
                Radius = (uint)Application.GetRealHeight(22),
            };
            addLayout.AddChidren(addBtn);
            #endregion
            FrameLayout frameLayout = new FrameLayout
            {
                Y = Application.GetRealHeight(64+84),
                Height = Application.GetRealHeight(667-64-84),
                Width = Application.GetRealWidth(TextSize.view375),
            };
            this.AddChidren(frameLayout);
 
            #region 保存布局
            FrameLayout saveLayout = new FrameLayout
            {
                Y = Application.GetRealHeight(667-104),
                Height = Application.GetRealHeight(104),
                Width = Application.GetRealWidth(TextSize.view375),
                BackgroundColor= CSS.CSS_Color.viewLine,
            };
            this.AddChidren(saveLayout);
 
            Button paixuBtn = new Button
            {
                Width = Application.GetRealWidth(375-16*2),
                Height = Application.GetRealHeight(20),
                Y = Application.GetRealHeight(12),
                X = Application.GetRealWidth(16),
                TextID = StringId.paixu,
                TextSize = TextSize.text14,
                TextColor = CSS.CSS_Color.textTipColor,
            };
            saveLayout.AddChidren(paixuBtn);
 
            Button saveBtn = new Button
            {
                Width = Application.GetRealWidth(220),
                Height = Application.GetRealHeight(44),
                Y = paixuBtn.Bottom+ Application.GetRealHeight(12),
                X = Application.GetRealWidth(78),
                TextID = StringId.save,
                TextSize = TextSize.text16,
                TextColor = CSS.CSS_Color.textWhiteColor,
                TextAlignment = TextAlignment.Center,
                BackgroundColor = CSS.CSS_Color.btnSaveBackgroundColor,
                Radius = (uint)Application.GetRealHeight(22),
 
            };
            saveLayout.AddChidren(saveBtn);
            #endregion
 
            VerticalScrolViewLayout vv = new VerticalScrolViewLayout();
            frameLayout.AddChidren(vv);
 
            int sum = Pir.BuottonList.Count/3+1;
            int h = sum * (16 + 44)+104;
            int line = 0;
            for (int i = 1, j = 0; i <= Pir.BuottonList.Count; i++, j++)
            {
                var nameObj = Pir.BuottonList[i-1];
                var FLayout = new FrameLayout
                {
                    Height = Application.GetRealWidth(h),
                };
                vv.AddChidren(FLayout);
              
                var buttonNameBtn = new Button
                {
                    Y =  Application.GetRealHeight(line*(16 + 44)),
                    X=Application.GetRealWidth(16+(16+104)*j),
                    Width = Application.GetRealWidth(104),
                    Height = Application.GetRealHeight(44),
                    Text= nameObj.value,
                    TextSize = TextSize.text16,
                    TextColor = CSS.CSS_Color.textColor,
                    TextAlignment = TextAlignment.Center,
                    Radius = (uint)Application.GetRealHeight(18),
                    BorderWidth = 1,
                    BorderColor = CSS.CSS_Color.textCancelColor,
                };
                FLayout.AddChidren(buttonNameBtn);
              
                if (i % 3 == 0)
                {
                    //满一行重置j=0值;
                    j = -1;
                    line += 1;
                }
 
            }
            #endregion
        }
    }
}