黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
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
using System;
using System.Collections.Generic;
using System.Text;
using ZigBee.Device;
 
namespace Shared.Phone.UserCenter.DeviceAirConditioner
{
    /// <summary>
    /// 中央空调的升级菜单界面
    /// </summary>
    public class ACZbGatewayUpdateMenuForm : EditorCommonForm
    {
        #region ■ 变量声明___________________________
 
        /// <summary>
        /// 设备
        /// </summary>
        private CommonDevice deviceAc = null;
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        /// <param name="i_deviceAc">设备</param>
        /// <param name="hadNewVersion">拥有新版本</param>
        public void ShowForm(CommonDevice i_deviceAc, bool hadNewVersion)
        {
            this.deviceAc = i_deviceAc;
 
            //设置头部信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uFirmwareUpdate));
 
            //初始化中部信息
            this.InitMiddleFrame(hadNewVersion);
        }
 
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        private void InitMiddleFrame(bool hadNewVersion)
        {
            //清空bodyFrame
            this.ClearBodyFrame();
 
            var frameBack = new FrameLayout();
            frameBack.Height = Application.GetRealHeight(8);
            frameBack.BackgroundColor = UserCenterColor.Current.White;
            bodyFrameLayout.AddChidren(frameBack);
 
            var listView = new VerticalListControl(12);
            listView.Y = frameBack.Bottom;
            listView.Height = bodyFrameLayout.Height;
            listView.BackgroundColor = UserCenterColor.Current.White;
            bodyFrameLayout.AddChidren(listView);
 
            var btnNewVersion = new PicViewControl(78, 55);
            //通信芯片
            var rowComunication = new FrameRowControl(listView.rowSpace / 2);
            listView.AddChidren(rowComunication);
            rowComunication.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uCommunicationChip), 600);
            rowComunication.AddRightArrow();
            rowComunication.AddBottomLine();
            rowComunication.ButtonClickEvent += (sender, e) =>
            {
                //这里是设备的Ota升级
                btnNewVersion.Visible = false;
                var form = new Device.DeviceFirmwareUpdateForm();
                form.AddForm(this.deviceAc.DeviceAddr);
            };
            //提示有新版本
            btnNewVersion.UnSelectedImagePath = "Item/NewVersion.png";
            btnNewVersion.Visible = hadNewVersion;
            btnNewVersion.X = Application.GetRealWidth(242);
            btnNewVersion.Y = Application.GetRealHeight(23);
            rowComunication.AddChidren(btnNewVersion, ChidrenBindMode.BindEvent);
 
            //空调模块
            var rowModel = new FrameRowControl(listView.rowSpace / 2);
            listView.AddChidren(rowModel);
            rowModel.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uAirConditioningModule), 600);
            rowModel.AddRightArrow();
            rowModel.ButtonClickEvent += (sender, e) =>
            {
                var form = new ACZbGatewayModuleUpdateForm();
                form.AddForm(deviceAc);
            };
 
            //调整列表高度
            listView.AdjustRealHeight(Application.GetRealHeight(23));
        }
 
        #endregion
 
        #region ■ 一般方法___________________________
 
        #endregion
    }
}