黄学彪
2020-12-16 0d9f64668fd7350d6a21fd157e32009a96d98134
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareUpdateForm.cs
@@ -12,9 +12,9 @@
    {
        #region ■ 变量声明___________________________
        /// <summary>
        /// 设备mac地址
        /// </summary>
        /// <summary>
        /// 设备mac地址
        /// </summary>
        private string deviceMac = null;
        /// <summary>
        /// 固件信息
@@ -28,34 +28,34 @@
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        /// <param name="i_deviceMac">设备mac地址</param>
        public void ShowForm(string i_deviceMac)
        /// <param name="i_deviceMac">设备mac地址</param>
        public void ShowForm(string i_deviceMac)
        {
            if (deviceMac != null && deviceMac != i_deviceMac)
            {
                //不是同一个东西
                return;
            }
            this.deviceMac = i_deviceMac;
            //设置标题信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uFirmwareUpdate));
            //初始化中部控件
            this.InitMiddleFrame();
            //历史版本
            this.InitTopRightMenu();
        }
            this.deviceMac = i_deviceMac;
            //设置标题信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uFirmwareUpdate));
            //初始化中部控件
            this.InitMiddleFrame();
            //历史版本
            this.InitTopRightMenu();
        }
        /// <summary>
        /// 初始化中部控件
        /// </summary>
        private void InitMiddleFrame()
        /// </summary>
        private void InitMiddleFrame()
        {
            var oTADevice = Common.LocalDevice.Current.GetOTADevice(deviceMac);
            var oTADevice = HdlDeviceCommonLogic.Current.GetOTADevice(deviceMac);
            //获取设备最新版本
            this.deviceFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.A设备,
            this.deviceFirmware = HdlFirmwareUpdateLogic.Current.GetFirmwareMostVersionInfo(FirmwareLevelType.A设备,
                oTADevice.HwVersion.ToString(),
                oTADevice.ImgTypeId.ToString(),
                oTADevice.ImgVersion);
@@ -76,19 +76,19 @@
            {
                //没有新版本
                this.InitControlByNotNewVersion();
            }
            }
        }
        #endregion
        #region ■ 右上角菜单_________________________
        #region ■ 右上角菜单_________________________
        /// <summary>
        /// 初始化右上角菜单
        /// </summary>
        /// </summary>
        private void InitTopRightMenu()
        {
            if (UserCenterResourse.HideOption.DeviceHistory != 1)
            if (HdlUserCenterResourse.HideOption.DeviceHistory != 1)
            {
                return;
            }
@@ -105,7 +105,7 @@
        /// <summary>
        /// 显示右上角菜单界面
        /// </summary>
        /// </summary>
        private void ShowTopRightMenu()
        {
            var frame = new TopRightMenuControl(1, 2);
@@ -136,7 +136,7 @@
            //清空bodyFrame
            this.ClearBodyFrame();
            var oTADevice = Common.LocalDevice.Current.GetOTADevice(deviceMac);
            var oTADevice = HdlDeviceCommonLogic.Current.GetOTADevice(deviceMac);
            //升级
            var btnUpdate = new BottomClickButton();
@@ -162,7 +162,7 @@
            frameNow.Y = Application.GetRealHeight(20);
            frameWhiteBack.AddChidren(frameNow);
            frameNow.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uNowFirmwareVersion), 500);
            frameNow.AddMostRightView(Common.LocalDevice.Current.AppendVersion(oTADevice.ImgVersion), 500);
            frameNow.AddMostRightView(HdlDeviceCommonLogic.Current.AppendVersion(oTADevice.ImgVersion), 500);
            frameNow.AddBottomLine();
            //最新固件版本
@@ -171,11 +171,11 @@
            frameNew.Y = frameNow.Bottom + Application.GetRealHeight(12);
            frameWhiteBack.AddChidren(frameNew);
            frameNew.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uNewFirmwareVersion), 500);
            frameNew.AddMostRightView(Common.LocalDevice.Current.AppendVersion(deviceFirmware.FirmwareVersion), 500);
            frameNew.AddMostRightView(HdlDeviceCommonLogic.Current.AppendVersion(deviceFirmware.FirmwareVersion), 500);
            frameNew.AddBottomLine();
            //添加固件介绍行
            int maxHeight = btnUpdate.Y - ControlCommonResourse.BottomButtonAndListViewSpace - frameNew.Bottom;
            int maxHeight = btnUpdate.Y - HdlControlResourse.BottomButtonAndListViewSpace - frameNew.Bottom;
            this.AddUpdateContent(deviceFirmware, maxHeight, frameNew.Bottom);
        }
@@ -191,7 +191,7 @@
            //清空bodyFrame
            this.ClearBodyFrame();
            var oTADevice = Common.LocalDevice.Current.GetOTADevice(deviceMac);
            var oTADevice = HdlDeviceCommonLogic.Current.GetOTADevice(deviceMac);
            var frameWhiteBack = new FrameLayout();
            frameWhiteBack.Height = Application.GetRealHeight(308);
@@ -204,7 +204,7 @@
            frameNow.Y = Application.GetRealHeight(20);
            frameWhiteBack.AddChidren(frameNow);
            frameNow.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uNowFirmwareVersion), 500);
            frameNow.AddMostRightView(Common.LocalDevice.Current.AppendVersion(oTADevice.ImgVersion), 500);
            frameNow.AddMostRightView(HdlDeviceCommonLogic.Current.AppendVersion(oTADevice.ImgVersion), 500);
            frameNow.AddBottomLine();
            //最新固件版本
@@ -225,7 +225,7 @@
        /// </summary>
        /// <param name="versionInfo">固件对象</param>
        /// <param name="Maxheight">最大高度</param>
        /// <param name="YY"></param>
        /// <param name="YY"></param>
        private void AddUpdateContent(FirmwareVersionInfo versionInfo, int Maxheight,int YY)
        {
            FrameListControl listFrame = null;
@@ -362,12 +362,12 @@
            ProgressFormBar.Current.CloseEvent += () =>
            {
                //升级对象
                if (FirmwareUpdateResourse.dicUpdateList.ContainsKey(deviceMac) == true
                    && FirmwareUpdateResourse.dicUpdateList[deviceMac].IsFinishUpdate == true)
                if (HdlFirmwareUpdateResourse.dicUpdateList.ContainsKey(deviceMac) == true
                    && HdlFirmwareUpdateResourse.dicUpdateList[deviceMac].IsFinishUpdate == true)
                {
                    //如果设备已经升级完成,界面关闭时,则移除内存
                    FirmwareUpdateResourse.dicUpdateList[deviceMac].Dispose();
                    FirmwareUpdateResourse.dicUpdateList.Remove(deviceMac);
                    HdlFirmwareUpdateResourse.dicUpdateList[deviceMac].Dispose();
                    HdlFirmwareUpdateResourse.dicUpdateList.Remove(deviceMac);
                }
            };
        }