黄学彪
2020-12-17 6c0c799c1f5da2d215ec8d9df9b92b3d1948dc14
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
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class SwitchView
    {
 
        /// <summary>
        /// 主控件
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            BackgroundColor = CSS.CSS_Color.view,
            Y = Application.GetRealHeight(515),
            X = Application.GetRealWidth(16),
            Height = Application.GetRealHeight(44 * 44),
            Width = Application.GetRealWidth(343),
            Radius = (uint)Application.GetRealHeight(12)
        };
        /// <summary>
        /// 取消
        /// </summary>
        public Button btnCancel = new Button
        {
            TextAlignment = TextAlignment.Center,
            TextSize = TextSize.text16,
            TextColor = CSS.CSS_Color.textRedColor,
            TextID = StringId.cancelSelected,
            Y = Application.GetRealHeight(611),
            X = Application.GetRealWidth(16),
            Height = Application.GetRealHeight(44),
            Width = Application.GetRealWidth(343),
            BackgroundColor = CSS.CSS_Color.view,
            Radius = (uint)Application.GetRealHeight(12)
        };
        /// <summary>
        /// 开
        /// </summary>
        public Button btnOn = new Button
        {
            TextAlignment = TextAlignment.Center,
            TextSize = LogicView.TextSize.text16,
            TextColor = CSS.CSS_Color.textCancelColor,
            TextID = StringId.onLogic,
            Height = Application.GetRealHeight(44),
            Width = Application.GetRealWidth(343),
 
        };
        /// <summary>
        /// 线
        /// </summary>
        public Button btnLine = new Button
        {
            Height = 1,
            BackgroundColor = CSS.CSS_Color.viewLine,
            Y = Application.GetRealHeight(43),
        };
        /// <summary>
        /// 关
        /// </summary>
        public Button btnOff = new Button
        {
            Y = Application.GetRealHeight(44),
            TextAlignment = TextAlignment.Center,
            TextSize = LogicView.TextSize.text16,
            TextColor = CSS.CSS_Color.textCancelColor,
            TextID = StringId.offLogic,
            Height = Application.GetRealHeight(44),
            Width = Application.GetRealWidth(343),
        };
        /// <summary>
        /// 线1
        /// </summary>
        public Button btnLine1 = new Button
        {
            Height = 1,
            BackgroundColor = CSS.CSS_Color.viewLine,
            Y = Application.GetRealHeight(43 + 44),
        };
        /// <summary>
        /// 暂停
        /// </summary>
        public Button btnStop = new Button
        {
            Y = Application.GetRealHeight(44 + 44),
            TextAlignment = TextAlignment.Center,
            TextSize = LogicView.TextSize.text16,
            TextColor = CSS.CSS_Color.textCancelColor,
            TextID = StringId.stop,
            Height = Application.GetRealHeight(44),
            Width = Application.GetRealWidth(343),
        };
 
        /// <summary>
        /// View的方法
        /// </summary>
        ///  <param name="frame">父控件</param>
        /// <param name="i">显示选择View数量</param>
        /// <returns></returns>
        public void FLayoutView(FrameLayout frame, int i)
        {
            frameLayout.Y = Application.GetRealHeight(603 - (44 * i));
            frameLayout.Height = Application.GetRealHeight(44 * i);
            frame.AddChidren(frameLayout);
            frame.AddChidren(btnCancel);
            frameLayout.AddChidren(btnOn);
            frameLayout.AddChidren(btnLine);
            frameLayout.AddChidren(btnOff);
            if (i > 2)
            {
                /// 判断是否要是显示"暂停"按钮
                frameLayout.AddChidren(btnLine1);
                frameLayout.AddChidren(btnStop);
            }
            btnCancel.MouseUpEventHandler += (sender1, e1) =>
            {
                frame.RemoveFromParent();
            };
 
        }
    }
}