黄学彪
2020-12-16 0d9f64668fd7350d6a21fd157e32009a96d98134
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
using System;
using System.Collections.Generic;
using System.Text;
using ZigBee.Device;
 
namespace Shared.Phone.UserCenter.GatewayUpdate
{
    /// <summary>
    /// 网关虚拟驱动列表界面
    /// </summary>
    public class GatewayVirtualDriveInfoForm : EditorCommonForm
    {
        #region ■ 变量声明___________________________
 
        /// <summary>
        /// 虚拟驱动号列表信息
        /// </summary>
        private List<ZbGatewayData.DriveCodeObj> listCode = null;
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        /// <param name="i_listCode">虚拟驱动号列表信息</param>
        public void ShowForm(List<ZbGatewayData.DriveCodeObj> i_listCode)
        {
            this.listCode = i_listCode;
 
            //设置标题信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uVirtualDrive));
 
            //初始化中部控件
            this.InitMiddleFrame();
        }
 
        /// <summary>
        /// 初始化中部控件
        /// </summary>
        private void InitMiddleFrame()
        {
            //清空bodyFrame
            this.ClearBodyFrame();
 
            var listView = new VerticalListControl(23);
            listView.BackgroundColor = UserCenterColor.Current.White;
            listView.Height = bodyFrameLayout.Height;
            bodyFrameLayout.AddChidren(listView);
 
            for (int i = 0; i < listCode.Count; i++)
            {
                //创建一个可以展开和收缩的FrameLayout,相当于菜单栏
                var frameTable = new FrameListControl(12);
                frameTable.Height = HdlControlResourse.ListViewRowHeight + listView.rowSpace;
                listView.AddChidren(frameTable);
 
                //驱动号菜单
                var rowMenu = new FrameRowControl(frameTable.rowSpace / 2);
                frameTable.AddChidren(rowMenu);
                rowMenu.AddLeftCaption(listCode[i].DriveCode.ToString(), 400);
                rowMenu.AddBottomLine();
 
                var btnRight = rowMenu.AddMostRightEmptyIcon(58, 58);
                btnRight.UnSelectedImagePath = "Item/RightNext.png";
                btnRight.SelectedImagePath = "Item/Down.png";
                rowMenu.ButtonClickEvent += (sender, e) =>
                {
                    btnRight.IsSelected = !btnRight.IsSelected;
                    //变更的高度,默认为列表隐藏
                    int heightValue = HdlControlResourse.ListViewRowHeight + listView.rowSpace;
                    if (btnRight.IsSelected == true)
                    {
                        //展开模式时,扩大依据为:它有几个子控件
                        heightValue = frameTable.ChildrenCount * (HdlControlResourse.ListViewRowHeight + frameTable.rowSpace);
                    }
                    //自身高度变更
                    frameTable.Height = heightValue;
 
                    //变更列表高度
                    int realHeight = 0;
                    for (int j = 0; j < listView.ChildrenCount; j++)
                    {
                        realHeight += listView.GetChildren(j).Height;
                    }
                    //底部空白
                    realHeight += Application.GetRealHeight(23);
                    if (realHeight > bodyFrameLayout.Height)
                    {
                        realHeight = bodyFrameLayout.Height;
                    }
                    listView.Height = realHeight;
                };
 
                //镜像ID
                var row1 = new FrameRowControl(frameTable.rowSpace / 2);
                row1.LeftOffset = Application.GetRealWidth(167) - HdlControlResourse.XXLeft;
                row1.UseClickStatu = false;
                frameTable.AddChidren(row1);
                row1.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uImageId), 300);
                row1.AddMostRightView(listCode[i].DriveImageType.ToString(), 400);
                row1.AddBottomLine();
 
                //固件版本
                var row2 = new FrameRowControl(frameTable.rowSpace / 2);
                row2.LeftOffset = Application.GetRealWidth(167) - HdlControlResourse.XXLeft;
                row2.UseClickStatu = false;
                frameTable.AddChidren(row2);
                row2.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uFirmwareVersion), 300);
                row2.AddMostRightView(HdlDeviceCommonLogic.Current.AppendVersion(listCode[i].DriveFwVersion), 400);
                row2.AddBottomLine();
 
                //固件日期
                var row3 = new FrameRowControl(frameTable.rowSpace / 2);
                row3.LeftOffset = Application.GetRealWidth(167) - HdlControlResourse.XXLeft;
                row3.UseClickStatu = false;
                frameTable.AddChidren(row3);
                row3.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uHardwareDate), 300);
                row3.AddMostRightView("", 400);
                row3.AddBottomLine();
 
                //硬件版本
                var row4 = new FrameRowControl(frameTable.rowSpace / 2);
                row4.LeftOffset = Application.GetRealWidth(167) - HdlControlResourse.XXLeft;
                row4.UseClickStatu = false;
                frameTable.AddChidren(row4);
                row4.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uHardwareVersion), 300);
                row4.AddMostRightView(listCode[i].DriveHwVersion.ToString(), 400);
                row4.AddBottomLine();
            }
 
            listView.AdjustRealHeight(Application.GetRealHeight(23));
        }
 
        #endregion
    }
}