HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2021-01-14 d78515ac4ac8cf4a1785d9df18058d6724f12b79
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
using System;
using System.Collections.Generic;
using System.Text;
 
namespace Shared.Phone.UserCenter.GatewayAdd
{
    /// <summary>
    /// 无线网关AP模式的说明指示界面1
    /// </summary>
    public class WirelessApDirection1Form : EditorCommonForm
    {
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        public void ShowForm()
        {
            //设置头部信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddWirelessGateway));
 
            //初始化中部信息
            this.InitMiddleFrame();
        }
 
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        private void InitMiddleFrame()
        {
            //清空bodyFrame
            this.ClearBodyFrame();
 
            //图片
            var framePic = new FrameLayout();
            framePic.Width = this.GetPictrueRealSize(386);
            framePic.Height = this.GetPictrueRealSize(255);
            framePic.Gravity = Gravity.CenterHorizontal;
            framePic.Y = Application.GetRealHeight(228);
            framePic.BackgroundImagePath = "Gateway/WirelessApDirection.png";
            bodyFrameLayout.AddChidren(framePic);
 
            //网关上电配网
            var btnTitle = new NormalViewControl(300, 60, true);
            btnTitle.TextID = R.MyInternationalizationString.uGatewayPowerDistributionNetwork;
            btnTitle.X = Application.GetRealWidth(75);
            btnTitle.Y = framePic.Bottom + Application.GetRealHeight(213);
            btnTitle.IsBold = true;
            btnTitle.TextSize = 14;
            bodyFrameLayout.AddChidren(btnTitle);
 
            //1.上电,系统启动(系统指示灯SYS 7秒后亮起,持续50秒常亮)
            //2.网关连接局域网(SYS 3秒周期闪烁,灯光偏暗,持续20秒)
            //3.网关建立WI-FI热点(SYS 5秒周期闪烁,灯光变亮)
            //4.网关建立热点成功
            //5.点击下一步
            string[] ArryMsg = Language.StringByID(R.MyInternationalizationString.uAddWirelessApGatewayMsg1).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries);
            int YY = btnTitle.Bottom + Application.GetRealHeight(23);
            foreach (var msg in ArryMsg)
            {
                var btnMsg1 = new NormalViewControl(942, 60, true);
                btnMsg1.TextColor = UserCenterColor.Current.TextGrayColor1;
                btnMsg1.TextSize = 12;
                btnMsg1.Text = msg;
                btnMsg1.Y = YY;
                btnMsg1.X = Application.GetRealWidth(75);
                btnMsg1.IsMoreLines = true;
                btnMsg1.Height = Application.GetRealHeight(60) * this.GetRowCountByTextLength(btnMsg1, 942);
                bodyFrameLayout.AddChidren(btnMsg1);
 
                YY = btnMsg1.Bottom;
            }
 
            //查看帮助
            var btnHelp = this.AddHelpControl();
            btnHelp.ButtonClickEvent += (sender, e) =>
            {
                var form = new AddGatewayHelpForm();
                form.AddForm("Ap");
            };
 
            //下一步
            var btnNext = new BottomClickButton();
            btnNext.TextID = R.MyInternationalizationString.uNextway;
            bodyFrameLayout.AddChidren(btnNext);
            btnNext.ButtonClickEvent += (sender, e) =>
            {
                var form = new WirelessApDirection2Form();
                this.AddFromAndRemoveNowForm(form);
            };
        }
 
        /// <summary>
        /// 根据文本长度,获取行数
        /// </summary>
        /// <param name="btnContr"></param>
        /// <param name="i_width"></param>
        /// <returns></returns>
        private int GetRowCountByTextLength(NormalViewControl btnContr, int i_width)
        {
            int realWidth = btnContr.GetRealWidthByText();
            int myWidth = Application.GetRealWidth(i_width);
 
            int row = realWidth / myWidth;
            int value = realWidth % myWidth;
            if (value > 8)
            {
                row++;
            }
            return row;
        }
 
        #endregion
    }
}