黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs
@@ -72,7 +72,7 @@
            //设置标题信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice));
            this.gatewayId = GatewayResourse.NowSelectGatewayId;
            this.gatewayId = HdlGatewayResourse.NowSelectGatewayId;
            HdlGatewayLogic.Current.GetRealGateway(ref this.realGateway, this.gatewayId);
            //初始化中部控件
@@ -163,7 +163,7 @@
                return;
            }
            //根据设备Type创建对应的设备对象
            var device = Common.LocalDevice.Current.NewDeviceObjectByDeviceId((DeviceType)jobject.Value<int>("Device_ID"), jobject.Value<int>("Epoint"));
            var device = HdlDeviceCommonLogic.Current.NewDeviceObjectByDeviceId((DeviceType)jobject.Value<int>("Device_ID"), jobject.Value<int>("Epoint"));
            if (device == null)
            {
                return;
@@ -171,14 +171,14 @@
            device.DeviceInfo = info;
            //给新设备设置主键属性
            Common.LocalDevice.Current.SetNewDeviceMainKeys(device, jobject);
            HdlDeviceCommonLogic.Current.SetNewDeviceMainKeys(device, jobject);
            device.CurrentGateWayId = this.realGateway.GwId;
            //将DeviceInfo的属性设置到主属性中
            Common.LocalDevice.Current.SetDeviceInfoToMain(device, device);
            HdlDeviceCommonLogic.Current.SetDeviceInfoToMain(device, device);
            //添加设备的缓存
            device.IsOnline = 1;
            Common.LocalDevice.Current.AddDeviceToMemory(ref device);
            HdlDeviceCommonLogic.Current.AddDeviceToMemory(ref device);
            //刷新超时时间
            this.waitDeviceTimeOut = 20;
@@ -236,14 +236,17 @@
                    device.ReSave();
                    //设置设备功能类型 (不能在接收回路的地方写入,不然网关可能会超负荷)
                    Common.LocalDevice.Current.RefreshDeviceFunctionType(device, device, true);
                    HdlDeviceCommonLogic.Current.RefreshDeviceFunctionType(device, device, true);
                    System.Threading.Thread.Sleep(200);
                    //获取设备的固定属性
                    if (HdlDeviceFixedAttributeLogic.Current.SetAllFixedAttributeToDevice(device) == true)
                    if (HdlDeviceAttributeLogic.Current.ReadDeviceAllFixedAttribute(device) == true)
                    {
                        System.Threading.Thread.Sleep(200);
                    }
                }
                //读取设备的其他信息
                this.ReadDeviceOtherInfo(listDevice);
                //目前就弄一个
                HdlThreadLogic.Current.RunMain(() =>
@@ -269,7 +272,7 @@
            if (this.targetFormId != string.Empty)
            {
                //再关闭设备入网指导界面
                this.CloseFormByFormName(this.targetFormId);
                HdlFormLogic.Current.CloseFormByFormName(this.targetFormId);
            }
            //添加设备
@@ -546,6 +549,35 @@
        #endregion
        #region ■ 一般方法___________________________
        /// <summary>
        /// 读取设备的其他信息
        /// </summary>
        /// <param name="listDevice"></param>
        private void ReadDeviceOtherInfo(List<CommonDevice> listDevice)
        {
            var myTypeInfo = HdlDeviceCommonLogic.Current.GetMyDeviceEnumInfo(listDevice);
            if (myTypeInfo.BeloneType == DeviceBeloneType.A窗帘 && listDevice[0] is Rollershade)
            {
                HdlThreadLogic.Current.RunThread(async () =>
                {
                    for (int i = 1; i <= 3; i++)
                    {
                        //重置窗帘
                        var result = await HdlDeviceCurtainLogic.Current.RestoreCurtain((Rollershade)listDevice[0], i != 3 ? ShowErrorMode.NO : ShowErrorMode.YES);
                        if (result == true)
                        {
                            return;
                        }
                        await System.Threading.Tasks.Task.Delay(1000);
                    }
                });
            }
        }
        #endregion
        #region ■ 结构体_____________________________
        /// <summary>