黄学彪
2019-11-07 82a773d1783549caca563831aac8affc059deedf
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
using System;
using System.Collections.Generic;
using System.Text;
 
namespace Shared.Phone.UserCenter.GatewayAdd
{
    /// <summary>
    /// 添加无线网关选择网络的界面
    /// </summary>
    public class WirelessGwSelectNetworkForm : EditorCommonForm
    {
        #region ■ 变量声明___________________________
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        public void ShowForm()
        {
            //设置头部信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddWirelessGateway));
 
            //初始化中部信息
            this.InitMiddleFrame();
        }
 
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        private void InitMiddleFrame()
        {
            bodyFrameLayout.RemoveAll();
 
            //请选择网络
            var btnTitle = new DetailTitleControl(800, 141, true);
            btnTitle.TextID = R.MyInternationalizationString.uPleaseSelectNetwork;
            bodyFrameLayout.AddChidren(btnTitle);
 
            var frame = new FrameLayout();
            frame.Y = btnTitle.Bottom;
            frame.Height = ControlCommonResourse.ListViewRowHeight * 2;
            frame.Width = bodyFrameLayout.Width;
            frame.BackgroundColor = UserCenterColor.Current.White;
            bodyFrameLayout.AddChidren(frame);
 
            //名称
            string ssiD = Shared.WiimuUPnP.SSID;
            if (string.IsNullOrEmpty(ssiD) == false && ssiD.StartsWith("\"") && ssiD.EndsWith("\""))
            {
                ssiD = ssiD.Substring(1, ssiD.Length - 2);
            }
            var btnName = new FrameCaptionViewControl("", ssiD);
            frame.AddChidren(btnName);
            btnName.InitControl();
            btnName.AddBottomLine();
 
            //密码
            var btnPsw = new FrameCaptionInputControl("", string.Empty);
            btnPsw.Y = btnName.Bottom;
            frame.AddChidren(btnPsw);
            btnPsw.InitControl();
            btnPsw.Height = btnPsw.Height;
            btnPsw.txtInput.SecureTextEntry = true;
            btnPsw.txtInput.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputWifiPassword);
 
            var btnMsg = new NormalViewControl(btnPsw.txtInput.Width, false);
            btnMsg.X = btnPsw.txtInput.X;
            btnMsg.Y = btnPsw.txtInput.Bottom - Application.GetRealHeight(10);
            btnMsg.TextSize = 12;
            btnMsg.Height = Application.GetRealHeight(40);
            btnMsg.TextColor = UserCenterColor.Current.Red;
            btnPsw.AddChidren(btnMsg);
 
            //下一步
            var btnNext = new BottomClickButton();
            btnNext.TextID = R.MyInternationalizationString.uNextway;
            bodyFrameLayout.AddChidren(btnNext);
 
            btnNext.MouseUpEventHandler += (sender, e) =>
            {
                btnMsg.Text = string.Empty;
                if (btnPsw.Text == string.Empty)
                {
                    //请输入网络密码
                    btnMsg.Text = Language.StringByID(R.MyInternationalizationString.uPleaseInputWifiPassword);
                    return;
                }
 
                ////初始化Wi-Fi连接
                //Com.Mediatek.Elian.ElianNative.InitSmartConnection(1, 1);
                ////开始Wi-Fi连接
                //var result = Com.Mediatek.Elian.ElianNative.StartSmartConnection(btnName.Text, btnPsw.Text, "1");
 
                var form = new WirelessGwClickButtonForm();
                this.AddFromAndRemoveNowForm(form);
            };
        }
 
        #endregion
    }
}