黄学彪
2019-12-17 5986f63b75bd81c6cef262c670e9251c038cbf5d
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs
@@ -223,6 +223,9 @@
            //添加【通用信息】行
            this.AddGeneralInformationRow();
            //添加【空调模块版本(空调专用)】行
            this.AddAirConditionerModelVersionRow();
            if (isHdlDevice == true)
            {
                //添加【固件升级】行
@@ -256,10 +259,20 @@
                 {
                     if (UserCenterResourse.UserInfo.AuthorityNo == 1)
                     {
                         var userManagement = new Shared.Phone.UserCenter.DoorLock.UserManagement(doorLock);
                         Shared.Phone.UserView.HomePage.Instance.AddChidren(userManagement);
                         Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                         userManagement.Show();
                         Action action = null;
                         Action actionNone = null;
                         action = () =>
                         {
                             var userManagement = new Shared.Phone.UserCenter.DoorLock.UserManagement(doorLock);
                             Shared.Phone.UserView.HomePage.Instance.AddChidren(userManagement);
                             Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                             userManagement.Show();
                         };
                         actionNone = () =>
                         {
                             Shared.Phone.UserCenter.DoorLock.DoorLockCommonLayout.SecurityRequest(doorLock, action);
                         };
                         HdlCheckLogic.Current.CheckSecondarySecurity(action, actionNone);
                     }
                     else
                     {
@@ -267,10 +280,21 @@
                         var result = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid);
                         if (result == false)
                         {
                             var userManagement = new Shared.Phone.UserCenter.DoorLock.UserManagement(doorLock);
                             Shared.Phone.UserView.HomePage.Instance.AddChidren(userManagement);
                             Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                             userManagement.Show();
                             Action action = null;
                             Action actionNone = null;
                             action = () =>
                             {
                                 var userManagement = new Shared.Phone.UserCenter.DoorLock.UserManagement(doorLock);
                                 Shared.Phone.UserView.HomePage.Instance.AddChidren(userManagement);
                                 Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                                 userManagement.Show();
                             };
                             actionNone = () =>
                             {
                                 Shared.Phone.UserCenter.DoorLock.DoorLockCommonLayout.SecurityRequest(doorLock, action);
                             };
                             HdlCheckLogic.Current.CheckSecondarySecurity(action, actionNone);
                         }
                         else
                         {
@@ -629,7 +653,7 @@
            //添加属性上报监听
            string mainkeys = LocalDevice.Current.GetDeviceMainKeys(this.listNewDevice[0]);
            HdlDeviceAttributeLogic.Current.AddAttributeEvent("HandPullControl", "DeviceStatusReport", (device) =>
            HdlGatewayReceiveLogic.Current.AddAttributeEvent("HandPullControl", ReceiveComandDiv.A设备属性上报, (device) =>
            {
                string checkKey = LocalDevice.Current.GetDeviceMainKeys(device);
                if (mainkeys != checkKey || device.DeviceStatusReport.CluterID != 258)
@@ -707,6 +731,51 @@
        #endregion
        #region ■ 空调模块版本(空调专用)_____________
        /// <summary>
        /// 添加【空调模块版本】行(河东的中央空调)
        /// </summary>
        private void AddAirConditionerModelVersionRow()
        {
            if (this.deviceEnumInfo.ConcreteType != DeviceConcreteType.AirConditioner_ZbGateway)
            {
                //不是中央空调
                return;
            }
            string caption = Language.StringByID(R.MyInternationalizationString.uAirConditionerModelVersion);
            var rowVersion = new FrameRowControl(listview.rowSpace / 2);
            rowVersion.UseClickStatu = false;
            listview.AddChidren(rowVersion);
            rowVersion.AddLeftCaption(caption, 600);
            //版本
            var btnVersion = rowVersion.AddMostRightView(Language.StringByID(R.MyInternationalizationString.uGetting), 800);
            //底线
            rowVersion.AddBottomLine();
            HdlThreadLogic.Current.RunThread(async () =>
            {
                //读取空调模块版本
                var result = await ((AC)listNewDevice[0]).ReadACFirewareVersionAsync();
                if (result == null || result.readACFirewareVersionResponData == null || result.readACFirewareVersionResponData.Status != 0)
                {
                    HdlThreadLogic.Current.RunMain(() =>
                    {
                        //获取失败
                        btnVersion.TextID = R.MyInternationalizationString.uGettingFail;
                    });
                }
                else
                {
                    HdlThreadLogic.Current.RunMain(() =>
                    {
                        btnVersion.Text = result.readACFirewareVersionResponData.FirewareVersion.Replace("-", string.Empty);
                    });
                }
            });
        }
        #endregion
        #region ■ 固件升级___________________________
        /// <summary>
@@ -736,14 +805,24 @@
            btnNewVersion.UnSelectedImagePath = "Item/NewVersion.png";
            btnNewVersion.Visible = false;
            btnNewVersion.X = Application.GetRealWidth(242);
            btnNewVersion.Y= Application.GetRealHeight(23);
            btnNewVersion.Y = Application.GetRealHeight(23);
            rowUpDate.AddChidren(btnNewVersion, ChidrenBindMode.BindEventOnly);
            rowUpDate.ButtonClickEvent += (sender, e) =>
            {
                if (this.deviceEnumInfo.ConcreteType != DeviceConcreteType.AirConditioner_ZbGateway)
                {
                    //这个是一般设备的升级
                    var form = new DeviceFirmwareUpdateForm();
                    form.AddForm(listNewDevice[0].DeviceAddr);
                }
                else
                {
                    //中央空调的升级的话,是特殊的
                    var form = new DeviceAirConditioner.ACZbGatewayUpdateMenuForm();
                    form.AddForm(listNewDevice[0].DeviceAddr, btnNewVersion.Visible);
                }
                btnNewVersion.Visible = false;
                var form = new DeviceFirmwareInfoForm();
                form.AddForm(listNewDevice[0].DeviceAddr);
            };
            //设置设备的版本信息
@@ -806,7 +885,7 @@
        /// 设备重命名
        /// </summary>
        /// <param name="i_deviceName">deviceName.</param>
        private async void DeviceReName(string i_deviceName,bool closeForm)
        private async void DeviceReName(string i_deviceName, bool closeForm)
        {
            //开启进度条
            this.ShowProgressBar();
@@ -897,16 +976,27 @@
        /// <summary>
        /// 删除指定设备
        /// </summary>
        private async void DoDeleteDevice()
        private void DoDeleteDevice()
        {
            //删除设备
            bool result = await Common.LocalDevice.Current.DeleteDevice(listNewDevice);
            if (result == false)
            HdlThreadLogic.Current.RunThread(async () =>
            {
                return;
            }
            //关闭界面
            this.CloseForm();
                //打开进度条
                this.ShowProgressBar();
                //删除设备
                bool result = await Common.LocalDevice.Current.DeleteDevice(listNewDevice);
                //关闭进度条
                this.CloseProgressBar();
                if (result == false)
                {
                    return;
                }
                HdlThreadLogic.Current.RunMain(() =>
                {
                    //关闭界面
                    this.CloseForm();
                });
            });
        }
        #endregion
@@ -915,13 +1005,13 @@
        /// <summary>
        /// 画面关闭
        /// </summary>
        public override void CloseForm()
        public override void CloseFormBefore()
        {
            HdlDeviceAttributeLogic.Current.RemoveEvent("HandPullControl");
            HdlGatewayReceiveLogic.Current.RemoveEvent("HandPullControl");
            //移除获取设备硬件信息的监听线程
            HdlDeviceHardInfoLogic.Current.RemoveDeviceHardInfoThread(listNewDevice[0]);
            base.CloseForm();
            base.CloseFormBefore();
        }
        #endregion