HDL Home App 第二版本 旧平台金堂用 正在使用
hxb
2022-08-30 25429f085093d89d543a0b90e30d0d62d1b7dac9
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
using System;
using System.Collections.Generic;
using System.Text;
 
namespace Shared.Phone.UserCenter.GatewayAdd
{
    /// <summary>
    /// Mini网关的说明指示界面1
    /// </summary>
    public class MiniGatewayDirection2Form : EditorCommonForm
    {
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        public void ShowForm()
        {
            //设置头部信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddMiniGateway));
 
            //初始化中部信息
            this.InitMiddleFrame();
        }
 
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        private void InitMiddleFrame()
        {
            //清空bodyFrame
            this.ClearBodyFrame();
 
            //下一步
            var btnNext = new BottomClickButton();
            btnNext.TextID = R.MyInternationalizationString.uNextway;
            bodyFrameLayout.AddChidren(btnNext);
            btnNext.ButtonClickEvent += (sender, e) =>
            {
                //如果不是热点模式
                //if (HdlWifiLogic.Current.IsMiniGatewayHotspot == false)
                //{
                //    //请选择hdlZigbeeGW-xxxx网络
                //    this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uPleaseSelectGatewayXXNet));
                //    return;
                //}
                var errorMsg = HdlWifiLogic.Current.StartApTcpConnection();
                if (errorMsg != null)
                {
                    //拥有错误
                    this.ShowMassage(ShowMsgType.Tip, errorMsg);
                    return;
                }
                this.CloseForm();
                var form = new MiniGatewaySelectNetworkForm();
                form.AddForm();
            };
            //如果不是Mini网关热点
            //if (HdlWifiLogic.Current.IsMiniGatewayHotspot == false)
            //{
            //    btnNext.Visible = false;
            //}
 
            //图片
            var framePic = new FrameLayout();
            framePic.Width = this.GetPictrueRealSize(848);
            framePic.Height = this.GetPictrueRealSize(475);
            framePic.Gravity = Gravity.CenterHorizontal;
            framePic.Y = Application.GetRealHeight(199);
            framePic.BackgroundImagePath = "Gateway/WirelessGatewaySearching.png";
            bodyFrameLayout.AddChidren(framePic);
 
            //手机连接网关热点
            var btnTitle = new NormalViewControl(400, 60, true);
            btnTitle.TextID = R.MyInternationalizationString.uMobileConnectionGatewayHotspot;
            btnTitle.X = Application.GetRealWidth(75);
            btnTitle.Y = framePic.Bottom + Application.GetRealHeight(107);
            btnTitle.IsBold = true;
            btnTitle.TextSize = 14;
            bodyFrameLayout.AddChidren(btnTitle);
 
            //1.网关热点的账号为hdlZigbeeGW-XXX,密码为hdl123456
            //2.具体账号和密码可查看网关标签
            //3.点击"{1}"完成手机连接网关热点
            //4.点击下一步
            string[] ArryMsg = Language.StringByID(R.MyInternationalizationString.uAddApWirelessGatewayMsg2).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries);
            int yy = btnTitle.Bottom + Application.GetRealHeight(23);
            for (int i = 0; i < ArryMsg.Length; i++)
            {
                if (i != 2)
                {
                    var btnMsg = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false);
                    btnMsg.Text = ArryMsg[i];
                    btnMsg.Y = yy;
                    btnMsg.X = btnTitle.X;
                    btnMsg.TextColor = UserCenterColor.Current.TextGrayColor1;
                    btnMsg.TextSize = 12;
                    bodyFrameLayout.AddChidren(btnMsg);
                    yy = btnMsg.Bottom;
                }
                else
                {
                    //3.点击"{1}"完成手机连接网关热点
                    var myArry = ArryMsg[i].Split(new string[] { "{1}" }, StringSplitOptions.RemoveEmptyEntries);
                    //3.点击
                    var btnMsg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false);
                    btnMsg1.Text = myArry[0];
                    btnMsg1.Y = yy;
                    btnMsg1.X = btnTitle.X;
                    btnMsg1.TextColor = UserCenterColor.Current.TextGrayColor1;
                    btnMsg1.TextSize = 12;
                    btnMsg1.Width = btnMsg1.GetRealWidthByText();
                    bodyFrameLayout.AddChidren(btnMsg1);
 
                    //去设置
                    var btnSettion = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false);
                    btnSettion.X = btnMsg1.Right;
                    btnSettion.Y = btnMsg1.Y;
                    btnSettion.TextSize = 12;
                    btnSettion.TextAlignment = TextAlignment.Center;
                    btnSettion.TextColor = 0xff0075ff;
                    btnSettion.Text = Language.StringByID(R.MyInternationalizationString.uGotoSettion);
                    btnSettion.Width = btnSettion.GetRealWidthByText();
                    bodyFrameLayout.AddChidren(btnSettion);
                    btnSettion.ButtonClickEvent += (sender, e) =>
                    {
                        HdlWifiLogic.Current.OpenAppWifiSettion();
                        btnNext.Visible = true;
                    };
                    //底线
                    var btnLine1 = new NormalViewControl(btnSettion.Width, ControlCommonResourse.BottomLineHeight, false);
                    btnLine1.BackgroundColor = 0xff0075ff;
                    btnLine1.X = btnSettion.X;
                    btnLine1.Y = btnSettion.Bottom - Application.GetRealHeight(8);
                    bodyFrameLayout.AddChidren(btnLine1);
 
                    //完成手机连接网关热点
                    var btnMsg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false);
                    btnMsg2.Text = myArry[1];
                    btnMsg2.Y = btnMsg1.Y;
                    btnMsg2.X = btnSettion.Right;
                    btnMsg2.TextColor = UserCenterColor.Current.TextGrayColor1;
                    btnMsg2.TextSize = 12;
                    btnMsg2.Width = btnMsg2.GetRealWidthByText();
                    bodyFrameLayout.AddChidren(btnMsg2);
 
                    yy = btnMsg1.Bottom;
                }
 
            }
 
            //查看帮助
            var btnHelp = this.AddHelpControl();
            btnHelp.ButtonClickEvent += (sender, e) =>
            {
                var form = new AddGatewayHelpForm();
                form.AddForm("Mini");
            };
        }
 
        #endregion
    }
}