xm
2021-12-01 6d73bf6e816570291865674bef8bce8972e4de3f
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
using System;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using HDL_ON.Stan;
using Shared;
 
namespace HDL_ON.UI
{
    public class AddQingpingSensorEnvirTipPage : EditorCommonForm
    {
        #region ■ 变量声明___________________________
 
        /// <summary>
        /// 添加设备完成之后的回调事件
        /// </summary>
        public Action<Function> AddDeviceEvent = null;
 
        IntegratedBrandDevice integratedDevice = null;
 
        #endregion
 
        #region ■ 初始化_____________________________
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        public void ShowForm(IntegratedBrandDevice device)
        {
            integratedDevice = device;
            if (Language.CurrentLanguage == "Chinese")
            {
                //设置头部信息
                base.SetTitleText(Language.StringByID(StringId.Add) + device.productName);
            }
            else
            {
                base.SetTitleText(Language.StringByID(StringId.Add) + " " + device.productName);
            }
            //这个界面的背景需要白色
            bodyFrameLayout.BackgroundColor = UI.CSS.CSS_Color.MainBackgroundColor;
 
            //初始化中部信息
            this.InitMiddleFrame();
        }
 
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        private void InitMiddleFrame()
        {
            //图片
            var btnPic = new PicViewControl(132, 132);
            btnPic.Y = Application.GetRealHeight(69);
            btnPic.Gravity = Gravity.CenterHorizontal;
            if(integratedDevice.spk == SPK.SensorEnvironment3)
            {
                btnPic.UnSelectedImagePath = "PersonalCenter/AddDevice/EnvirSensorQingpingLitebg.png";
            }else if (integratedDevice.spk == SPK.SensorEnvironment2)
            {
                btnPic.UnSelectedImagePath = "PersonalCenter/AddDevice/EnvirSensorQingpingCGS1bg.png";
            }
            bodyFrameLayout.AddChidren(btnPic);
 
            //请输入设备机上的sn码
            var textView = new FrameLayout()
            {
                Y = Application.GetRealHeight(309 - 64),
                Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth(319),
                Height = Application.GetRealHeight(144),
            };
            bodyFrameLayout.AddChidren(textView);
 
            Button btnTipTitle = new Button()
            {
                TextAlignment = TextAlignment.Center,
                TextColor = CSS.CSS_Color.FirstLevelTitleColor,
                TextSize = CSS.CSS_FontSize.TextFontSize,
                Text = "请下载“青萍+”APP为设备配置网络",
                IsBold = true,
                IsMoreLines = true,
                Height = Application.GetRealHeight(30),
            };
            textView.AddChidren(btnTipTitle);
            if(Language.CurrentLanguage != "Chinese")
            {
                btnTipTitle.Text = "Please download the 'Qingping +' app to configure the network for the device";
            }
            Button btnTipMsg = new Button()
            {
                Y = btnTipTitle.Bottom,
                TextAlignment = TextAlignment.TopCenter,
                TextColor = CSS.CSS_Color.PromptingColor1,
                TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel,
                Text = @"网络配置完成后,点击该设备查看数据页面,{0}点击右上角设置功能{0}找到“WIFI - MAC”并复制改MAC码",
                IsMoreLines = true,
                Height = Application.GetRealHeight(80),
            };
            textView.AddChidren(btnTipMsg);
            if (Language.CurrentLanguage != "Chinese")
            {
                btnTipMsg.Text = @"After the network configuration is completed, click the device to view the data page,{0}Click the setting function in the upper right corner{0}Find ‘wifi-mac' and copy the modified MAC code";
            }
            btnTipMsg.Text = btnTipMsg.Text.Replace("{0}", "\r\n");
            //下一步
            var btnNext = this.AddBottomClickButton(Language.StringByID(StringId.Next));
            btnNext.ButtonClickEvent += (sender, e) =>
            {
                var form2 = new AddSensorEnvironmentPage();
                form2.AddForm(integratedDevice);
                form2.AddDeviceEvent = AddDeviceEvent;
            };
        }
 
        #endregion
 
        #region ■ 关闭界面___________________________
 
        /// <summary>
        /// 关闭界面
        /// </summary>
        public override void CloseFormBefore()
        {
            this.AddDeviceEvent = null;
            base.CloseFormBefore();
        }
 
        #endregion
    }
}