tzy
2021-05-25 65bcedda4d8e3ff6500dbf59a4e607d96e469375
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
using HDL_ON.Stan;
using Shared;
using System;
using System.Collections.Generic;
using System.Text;
 
namespace HDL_ON.UI
{
    /// <summary>
    /// 添加Evoyo的Mini智能遥控器步骤1界面
    /// </summary>
    public class AddMiniRemoteControlDirection1Page : EditorCommonForm
    {
        #region ■ 变量声明___________________________
 
        /// <summary>
        /// 添加设备完成之后的回调事件(温总说他自己要这个东西)
        /// </summary>
        public Action<Entity.Function> AddDeviceEvent = null;
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        public void ShowForm()
        {
            //设置头部信息
            base.SetTitleText(Language.StringByID(StringId.AddInfraredRemoteControl));
            //这个界面的背景需要白色
            bodyFrameLayout.BackgroundColor = UI.CSS.CSS_Color.MainBackgroundColor;
 
            //初始化中部信息
            this.InitMiddleFrame();
        }
 
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        private void InitMiddleFrame()
        {
            //图片
            var btnPic = new PicViewControl(149, 95);
            btnPic.Y = Application.GetRealHeight(99);
            btnPic.Gravity = Gravity.CenterHorizontal;
            btnPic.UnSelectedImagePath = "PersonalCenter/AddDevice/MiniRemoteControlBigPictrue.png";
            bodyFrameLayout.AddChidren(btnPic);
 
            //长按红外遥控器按钮10秒,指示灯蓝色快闪
            var strMsg = Language.StringByID(StringId.AddInfraredRemoteControlMsg1);
            var listContr = this.AddListMsgControls(bodyFrameLayout, strMsg, CSS.CSS_FontSize.TextFontSize,
                CSS.CSS_Color.FirstLevelTitleColor, Application.GetRealHeight(20), Application.GetRealHeight(408));
 
            //请确保您的蓝牙已开启并处于可以被搜索状态
            strMsg = Language.StringByID(StringId.AddInfraredRemoteControlMsg2);
            this.AddListMsgControls(bodyFrameLayout, strMsg, CSS.CSS_FontSize.PromptFontSize_FirstLevel,
                CSS.CSS_Color.PromptingColor1, Application.GetRealHeight(18), listContr[listContr.Count - 1].Bottom + Application.GetRealHeight(4));
 
            //下一步
            var btnNext = this.AddBottomClickButton(Language.StringByID(StringId.Next));
            btnNext.ButtonClickEvent += (sender, e) =>
            {
                //检测蓝牙需要的东西
                btnNext.CanClick = false;
                HdlBluetoothLogic.Current.CheckCanScanBluetooth((result) =>
                {
                    btnNext.CanClick = true;
                    if (result == true)
                    {
                        //注意:这个界面不能关闭,它用来回调温总的界面用的
                        var form = new AddMiniRemoteControlDirection2Page();
                        //初始wifi和密码为空
                        form.AddForm(string.Empty, string.Empty);
                    }
                });
            };
        }
 
        #endregion
 
        #region ■ 关闭界面___________________________
 
        /// <summary>
        /// 关闭界面
        /// </summary>
        public override void CloseFormBefore()
        {
            this.AddDeviceEvent = null;
            base.CloseFormBefore();
        }
 
        #endregion
    }
}