JLChen
2020-06-05 f86c8b5dcf5c84386745b009fc4115fa9db3b76d
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
using System;
namespace Shared.SimpleControl.Phone
{
    public class UserSensorAutomationTargetSet : FrameLayout
    {
 
        public void ShowPage (byte[] targetBytes)
        {
            this.BackgroundColor = SkinStyle.Current.MainColor;
            #region 标题
            var topView = new FrameLayout () {
                Y = Application.GetRealHeight (36),
                Height = Application.GetRealHeight (90),
                BackgroundColor = SkinStyle.Current.MainColor
            };
            AddChidren (topView);
 
            var title = new Button () {
                TextAlignment = TextAlignment.Center,
                Text = "目标配置",
                //TextID = R.MyInternationalizationString.SetPush,
                TextColor = SkinStyle.Current.TextColor1,
                TextSize = 19,
            };
            topView.AddChidren (title);
 
            var logo = new Button () {
                Width = Application.GetRealWidth (154),
                Height = Application.GetRealHeight (90),
                X = Application.GetRealWidth (486),
                UnSelectedImagePath = MainPage.LogoString,
            };
            topView.AddChidren (logo);
            var back = new Button () {
                Height = Application.GetRealHeight (90),
                Width = Application.GetRealWidth (85),
                UnSelectedImagePath = "Item/Back.png",
                SelectedImagePath = "Item/BackSelected.png",
            };
            topView.AddChidren (back);
            back.MouseUpEventHandler += (sender, e) => {
                (Parent as PageLayout).PageIndex -= 1;
            };
            #endregion
 
 
            var bodyScrolView = new VerticalScrolViewLayout () {
                Y = topView.Bottom,
                BackgroundColor = SkinStyle.Current.ViewColor,
                Height = Application.GetRealHeight (1140 - 126),
                ScrollEnabled = false
            };
            AddChidren (bodyScrolView);
 
            FrameLayout typeView = new FrameLayout () { 
                Height = Application.GetRealHeight(100),
            };
            bodyScrolView.AddChidren (typeView);
 
            Button btnTypeText = new Button () { 
                X = Application.GetRealWidth(60),
                Width = Application.GetRealWidth(100),
                Text = "控制类型:",
                TextColor = SkinStyle.Current.TextColor1,
                TextAlignment = TextAlignment.CenterLeft,
            };
            typeView.AddChidren (btnTypeText);
 
            Button btnType = new Button () { 
                X = btnTypeText.Right,
                Width = Application.GetRealWidth(500),
                Text = GetControlTypeText(targetBytes[3]),
                TextColor = SkinStyle.Current.TextColor1,
                TextAlignment = TextAlignment.CenterLeft,
            };
            typeView.AddChidren (btnType);
 
            HorizontalScrolViewLayout targetTextView = new HorizontalScrolViewLayout () { 
                Height = Application.GetRealHeight(60),
            };
            bodyScrolView.AddChidren (targetTextView);
 
            Button btnSubnetIdText = new Button () { 
                Width = Application.GetRealWidth(220),
                Text = "子网号",
                TextAlignment = TextAlignment.Center,
                TextColor = SkinStyle.Current.TextColor1,
            };
            targetTextView.AddChidren (btnSubnetIdText);
 
            Button btnDeviceIdText = new Button () {
                Width = Application.GetRealWidth(200),
                Text = "设备号",
                TextAlignment = TextAlignment.Center,
                TextColor = SkinStyle.Current.TextColor1,
            };
            targetTextView.AddChidren (btnDeviceIdText);
 
            Button btnLoopIdText = new Button () { 
                Width = Application.GetRealWidth(220),
                Text = "回路号",
                TextAlignment = TextAlignment.Center,
                TextColor = SkinStyle.Current.TextColor1,
            };
            targetTextView.AddChidren (btnLoopIdText);
 
            HorizontalScrolViewLayout targetView = new HorizontalScrolViewLayout () {
                Height = Application.GetRealHeight (60),
            };
            bodyScrolView.AddChidren (targetView);
 
            Button btnSubnetId = new Button () {
                Width = Application.GetRealWidth (220),
                Text = "子网号",
                TextAlignment = TextAlignment.Center,
                TextColor = SkinStyle.Current.TextColor1,
            };
            targetView.AddChidren (btnSubnetId);
 
            Button btnDeviceId = new Button () {
                Width = Application.GetRealWidth (200),
                Text = "设备号",
                TextAlignment = TextAlignment.Center,
                TextColor = SkinStyle.Current.TextColor1,
            };
            targetView.AddChidren (btnDeviceId);
 
            Button btnLoopId = new Button () {
                Width = Application.GetRealWidth (220),
                Text = "回路号",
                TextAlignment = TextAlignment.Center,
                TextColor = SkinStyle.Current.TextColor1,
            };
            targetView.AddChidren (btnLoopId);
 
        }
 
 
 
        public string GetControlTypeText (byte readTargetByte)
        {
            string targetDeviceControlType = "";
            switch (readTargetByte) {
            case 0://0   无效 Invalid
                targetDeviceControlType = "无效";
                break;
            case 85://0x55  场景 Scene ||0x0002
                targetDeviceControlType = "场景";
                break;
            case 86://0x56  序列 Sequence ||0x001A
                targetDeviceControlType = "序列";
                break;
            case 88://0x58  通用开关 Universal Switch ||0xe01c
                targetDeviceControlType = "通用开关";
                break;
            case 89: //0x59  单路调节 Single Channel Lighting Control  0031
                targetDeviceControlType = "单路调节";
                break;
            case 92://0x5c  窗帘开关 Curtain Switch e3e0
                targetDeviceControlType = "窗帘开关";
                break;
            case 94://0x5e  GPRS控制 GPRS Control E3D4
                targetDeviceControlType = "GPRS控制";
                break;
            case 95://0x5f  面板控制 Panel Control e3d8
                targetDeviceControlType = "面板控制";
                break;
            case 100://0x64 广播场景 Broadcast Scene ||0x0002  
                targetDeviceControlType = "广播场景";
                break;
            case 101://0x65 广播回路 Broadcast Channel 0031
                targetDeviceControlType = "广播回路";
                break;
            case 102://0x66 消防模块 Security Module 011E
                targetDeviceControlType = "消防模块";
                break;
            case 103://0x67 音乐播放 Music Control 0218
                targetDeviceControlType = "音乐播放";
                break;
            }
            return targetDeviceControlType;
        }
    }
}