黄学彪
2020-09-22 ade5917841b0fdcb1df7353ef7c56b1a1bdc9282
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
using System;
using System.Collections.Generic;
using System.Text;
using ZigBee.Device;
 
namespace Shared.Phone.UserCenter.HideOption
{
    /// <summary>
    /// 本地缓存设备列表的界面
    /// </summary>
    public class HideOptionMemoryListDeviceForm : EditorCommonForm
    {
        #region ■ 变量声明___________________________
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        public void ShowForm()
        {
            //设置头部信息
            base.SetTitleText("设备列表");
 
            //初始化中部信息
            this.InitMiddleFrame();
        }
 
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        private void InitMiddleFrame()
        {
            var listView = new VerticalListControl(23);
            listView.BackgroundColor = UserCenterColor.Current.White;
            listView.Height = bodyFrameLayout.Height;
            bodyFrameLayout.AddChidren(listView);
 
            var listDevice = Common.LocalDevice.Current.listAllDevice;
            for (int i = 0; i < listDevice.Count; i++)
            {
                this.AddRowControl(listView, listDevice[i], i != listDevice.Count - 1);
            }
 
            listView.AdjustRealHeight(Application.GetRealHeight(23));
        }
 
        private void AddRowControl(VerticalListControl listView, CommonDevice device, bool addLine)
        {
            var row1 = new RowLayoutControl(listView.rowSpace / 2);
            listView.AddChidren(row1);
            row1.frameTable.AddTopView(Common.LocalDevice.Current.GetDeviceEpointName(device), 800);
            row1.frameTable.AddBottomView(device.FilePath, 800);
            if (addLine == true)
            {
                row1.frameTable.AddBottomLine();
            }
            row1.frameTable.AddRightArrow();
 
            row1.frameTable.ButtonClickEvent += (sender, e) =>
            {
                var txtContent = Newtonsoft.Json.JsonConvert.SerializeObject(device);
 
                var form = new HideOptionFileContentForm();
                form.AddForm(string.Empty);
 
                form.SetTextContent(txtContent);
            };
        }
 
        #endregion
 
        #region ■ 一般方法___________________________
 
        #endregion
    }
}