wei
2021-03-19 c7c61c603b16c0bf2582d81561bdfbe48ab9440c
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
using System;
using HDL_ON.DriverLayer;
using HDL_ON.Entity;
using HDL_ON.Stan;
using HDL_ON.UI.CSS;
using Shared;
 
namespace HDL_ON.UI
{
    public class IrLearnPage : DeviceFunctionCardCommonForm
    {
        #region ■ 变量声明___________________________
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 初始化白色区域的内容
        /// </summary>
        public override void InitFrameWhiteContent()
        {
 
            base.ShowColltionButton = false;
            base.SetTitleText(Language.StringByID(StringId.RemoteControl));
 
            //初始化第一个索引页的内容
            this.InitFrameWhiteContent1();
 
        }
 
        /// <summary>
        /// 初始化第一个索引页的内容
        /// </summary>
        private void InitFrameWhiteContent1()
        {
            var contentView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(94),
                Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth(296),
                Height = Application.GetRealHeight(376),
            };
            FrameWhiteCentet1.AddChidren(contentView);
 
            var row = new FrameLayout()
            {
                //Width = Application.GetRealWidth(200),
                Height = Application.GetRealHeight(56),
            };
            contentView.AddChidren(row);
 
            int index = 0;
            foreach(var attr in device.attributes)
            {
                if(index != 0 && index%3==0)
                {
                    row = new FrameLayout()
                    {
                        Width = Application.GetRealWidth(200),
                        Height = Application.GetRealHeight(56),
                    };
                    contentView.AddChidren(row);
                }
 
                var btn = new Button()
                {
                    Width = Application.GetRealWidth(88),
                    Height = Application.GetRealHeight(40),
                    Radius = (uint)Application.GetRealHeight(18),
                    BorderColor = CSS_Color.PromptingColor1,
                    BorderWidth = (uint)Application.GetRealWidth(2),
                    TextAlignment = TextAlignment.Center,
                    TextSize = CSS_FontSize.TextFontSize,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    SelectedTextColor = CSS_Color.MainBackgroundColor,
                    SelectedBackgroundColor = CSS_Color.MainColor,
                };
                if (attr.value.Count > 0)
                {
                    btn.Text = attr.value[0];
                }
                if (index % 3 == 1)
                {
                    btn.Gravity = Gravity.CenterHorizontal;
                }
                else if (index % 3 == 2)
                {
                    btn.X = Application.GetRealWidth(208);
                }
                row.AddChidren(btn);
 
                btn.MouseUpEventHandler = (sender, e) => {
                    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                    d.Add(attr.key, "");
                    Control.Ins.SendWriteCommand(device, d);
 
                    new System.Threading.Thread(() => {
                        System.Threading.Thread.Sleep(2000);
                        Application.RunOnMainThread(() => {
                            btn.IsSelected = false;
                        });
                    }) { IsBackground = true }.Start();
                };
 
 
 
                index++;
            }
 
        }
 
 
        #endregion
 
        #region ■ 设备状态反馈_______________________
 
        /// <summary>
        /// 设备状态反馈
        /// </summary>
        /// <param name="i_LocalDevice"></param>
        public override void DeviceStatuPush(Function i_LocalDevice)
        {
            return;
        }
 
        #endregion
 
        #region ■ 发送各种命令_______________________
         
        #endregion
 
        #region ■ 刷新界面状态_______________________
 
        /// <summary>
        /// 刷新界面状态
        /// </summary>
        private void RefreshFormStatu()
        {
            return;
        }
 
        #endregion
 
    }
}