xm
2020-07-10 acb2b278663952ce555b06a2e821f359225f15e0
ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/ACZbGatewayUpdateMenuForm.cs
New file
@@ -0,0 +1,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
    }
}