xm
2020-04-16 6fa9d69da922c8049f5acfcbb9ce9fd26811024c
ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs
@@ -61,7 +61,7 @@
        /// <param name="i_listdevice">窗帘的回路</param>
        public void ShowForm(Rollershade i_CurtainDevice)
        {
            UserView.HomePage.Instance.ScrollEnabled = false;
            this.ScrollEnabled = false;
            this.curtainDevice = i_CurtainDevice;
@@ -99,6 +99,24 @@
                listView.Height = bodyFrameLayout.Height;
                bodyFrameLayout.AddChidren(listView);
                //导轨长度为0时
                if (curtainData.CurtainLength <= 0)
                {
                    //电机数据异常,请重置电机
                    this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uCurtainDataIsErrorPleaseResetCurtain));
                    try
                    {
                        //设备异常补救 -> 添加重置电机行
                        this.AddElectricalMachineryRow();
                        return;
                    }
                    catch (Exception ex2)
                    {
                        HdlLogLogic.Current.WriteLog(ex2, "开合帘补救异常1");
                        return;
                    }
                }
                try
                {
                    //添加方向行
@@ -124,7 +142,7 @@
                        //设备异常补救 -> 添加重置电机行
                        this.AddElectricalMachineryRow();
                    }
                    catch (Exception ex2) { HdlLogLogic.Current.WriteLog(ex2, "开合帘补救异常"); }
                    catch (Exception ex2) { HdlLogLogic.Current.WriteLog(ex2, "开合帘补救异常2"); }
                }
            });
        }
@@ -234,6 +252,8 @@
            frameBack.AddChidren(btnProgressView);
            int progressValue = (int)(curtainData.OpenLimitValue / (curtainData.CurtainLength * 1.0) * 100);
            //设置百分比的初始值
            curtainData.OpenLimitPersent = progressValue;
            var btnProgress1 = new NormalViewControl(200, 50, true);
            btnProgress1.X = Application.GetRealWidth(200);
            btnProgress1.Y = btnProgressView.Y;
@@ -404,6 +424,8 @@
            frameBack.AddChidren(btnProgressView);
            int progressValue = (int)(curtainData.CloseLimitValue / (curtainData.CurtainLength * 1.0) * 100);
            //设置百分比的初始值
            curtainData.CloseLimitPersent = progressValue;
            var btnProgress1 = new NormalViewControl(200, 50, true);
            btnProgress1.X = Application.GetRealWidth(200);
            btnProgress1.Y = btnProgressView.Y;
@@ -637,7 +659,7 @@
            this.receiveCloseLimit = false;
            this.sendDiv = 0;
            bool receiptData = false;
            int receiptDataCount = 0;
            string mainkeys = LocalDevice.Current.GetDeviceMainKeys(curtainDevice);
            HdlGatewayReceiveLogic.Current.AddAttributeEvent("CurtainDeviceAttribute", ReceiveComandDiv.A设备属性上报, (device) =>
            {
@@ -661,23 +683,25 @@
                            //正向
                            curtainData.Direction = false;
                        }
                        receiptDataCount++;
                    }
                    else if (attriBute.AttributeId == 1)
                    {
                        //窗帘总长
                        curtainData.CurtainLength = attriBute.AttriButeData;
                        receiptDataCount++;
                    }
                    else if (attriBute.AttributeId == 16)
                    {
                        //开限位
                        curtainData.OpenLimitValue = attriBute.AttriButeData;
                        receiptDataCount++;
                    }
                    else if (attriBute.AttributeId == 17)
                    {
                        //合限位
                        curtainData.CloseLimitValue = attriBute.AttriButeData;
                        //数据接收结束
                        receiptData = true;
                        receiptDataCount++;
                    }
                }
            });
@@ -685,7 +709,7 @@
            HdlDeviceCurtainLogic.Current.SetGetCurtainLimitSettionComand(curtainDevice);
            int timeCount = 30;
            while (receiptData == false && timeCount >= 0)
            while (receiptDataCount != 4 && timeCount >= 0)
            {
                System.Threading.Thread.Sleep(100);
                timeCount--;
@@ -706,7 +730,7 @@
            HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute");
            //备份窗帘数据
            if (this.backupCurtainData == true)
            if (this.backupCurtainData == true && curtainData.CurtainLength > 0)
            {
                this.backupCurtainData = false;
                HdlThreadLogic.Current.RunThread(async () =>
@@ -775,8 +799,6 @@
        {
            HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute");
            HdlGatewayReceiveLogic.Current.RemoveEvent("ReceiveLimitData");
            UserView.HomePage.Instance.ScrollEnabled = true;
            base.CloseFormBefore();
        }