黄学彪
2019-10-24 31497bb69602433d94c8a28ea01c3ee3c7cc8576
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
using System;
using System.Collections.Generic;
using System.Text;
 
namespace Shared.Phone.UserCenter.DeviceDirection
{
    /// <summary>
    /// 燃气传感器的添加步骤界面
    /// </summary>
    public class SensorCarbonMonoxideDirectionForm : EditorCommonForm
    {
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        public void ShowForm()
        {
            //设置头部信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice));
 
            //初始化中部信息
            this.InitMiddleFrame();
        }
 
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        private void InitMiddleFrame()
        {
            //清空bodyFrame
            this.ClearBodyFrame();
 
            //图片
            var framePic = new FrameLayout();
            framePic.Width = Application.GetMinRealAverage(861);
            framePic.Height = Application.GetMinRealAverage(706);
            framePic.Gravity = Gravity.CenterHorizontal;
            framePic.Y = Application.GetRealHeight(135);
            bodyFrameLayout.AddChidren(framePic);
            var btnPic = new PicViewControl(framePic.Width, framePic.Height, false);
            btnPic.UnSelectedImagePath = "Instruct/SensorCarbonMonoxide.png";
            framePic.AddChidren(btnPic);
 
            //绿色指示灯快速闪烁
            var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(501), Application.GetMinRealAverage(45), false);
            btnGreanLinght.X = Application.GetMinRealAverage(357);
            btnGreanLinght.Y = Application.GetMinRealAverage(326);
            btnGreanLinght.TextAlignment = TextAlignment.Center;
            btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnGreanLinght.TextSize = 10;
            btnGreanLinght.TextID = R.MyInternationalizationString.uGreanPilotLampLinghtQuickly;
            framePic.AddChidren(btnGreanLinght);
 
            //长按5秒
            //(按键)
            string textMsg = Language.StringByID(R.MyInternationalizationString.uLongClickPanelSomeSecond);
            if (textMsg.Contains("{0}") == true)
            {
                textMsg = string.Format(textMsg, "5");
            }
            int index = textMsg.IndexOf("(");
            string textMsg1 = textMsg.Substring(0, index);
            string textMsg2 = textMsg.Substring(index, textMsg.Length - index);
 
            var btnSecond1 = new NormalViewControl(Application.GetMinRealAverage(120), Application.GetMinRealAverage(45), false);
            btnSecond1.X = Application.GetMinRealAverage(138);
            btnSecond1.Y = Application.GetMinRealAverage(177);
            btnSecond1.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnSecond1.TextAlignment = TextAlignment.Center;
            btnSecond1.TextSize = 10;
            btnSecond1.Text = textMsg1;
            framePic.AddChidren(btnSecond1);
            var btnSecond2 = new NormalViewControl(Application.GetMinRealAverage(120), Application.GetMinRealAverage(45), false);
            btnSecond2.X = btnSecond1.X;
            btnSecond2.Y = btnSecond1.Bottom;
            btnSecond2.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnSecond2.TextSize = 10;
            btnSecond2.TextAlignment = TextAlignment.Center;
            btnSecond2.Text = textMsg2;
            framePic.AddChidren(btnSecond2);
 
            //长按图示按键5秒以上,绿色快闪
            //进入配网状态,绿灯常亮则入网成功
            string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddSensorCarbonMonoxideMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries);
 
            var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false);
            msg1.Y = Application.GetRealHeight(1037);
            msg1.Text = msgArry[0];
            msg1.TextColor = UserCenterColor.Current.TextGrayColor3;
            msg1.TextAlignment = TextAlignment.Center;
            bodyFrameLayout.AddChidren(msg1);
            var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false);
            msg2.Y = msg1.Bottom;
            if (msgArry.Length > 1)
            {
                msg2.Text = msgArry[1];
            }
            msg2.TextColor = UserCenterColor.Current.TextGrayColor3;
            msg2.TextAlignment = TextAlignment.Center;
            bodyFrameLayout.AddChidren(msg2);
 
            //查看帮助
            var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false);
            btnHelp.Y = Application.GetRealHeight(1388);
            btnHelp.TextSize = 12;
            btnHelp.TextAlignment = TextAlignment.Center;
            btnHelp.TextColor = UserCenterColor.Current.TextOrangeColor;
            btnHelp.Text = Language.StringByID(R.MyInternationalizationString.uSearchHelp);
            btnHelp.ButtonClickEvent += (sender, e) =>
            {
                var form = new DeviceDirectionHelpForm();
                form.AddForm(string.Empty);
            };
            bodyFrameLayout.AddChidren(btnHelp);
            //底线
            int lineWidth = btnHelp.GetRealWidthByText(12);
            var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false);
            btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
            btnLine.Gravity = Gravity.CenterHorizontal;
            btnLine.Y = btnHelp.Bottom - Application.GetRealHeight(8);
            bodyFrameLayout.AddChidren(btnLine);
 
            //下一步
            var btnNext = new BottomClickButton();
            btnNext.TextID = R.MyInternationalizationString.uNextway;
            bodyFrameLayout.AddChidren(btnNext);
            btnNext.ButtonClickEvent += (sender, e) =>
            {
                var form = new Device.DeviceSearchForm();
                form.AddForm(this.FormID);
            };
        }
 
        #endregion
    }
}