From 3272ca5b51e19f7f8a827b0f68400570a547fe60 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 28 四月 2020 15:02:44 +0800 Subject: [PATCH] 2020-04-28-1 --- ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs | 40 +++++++++++++++++++++++++++++++--------- 1 files changed, 31 insertions(+), 9 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs index 38eaf8a..de7b257 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs +++ b/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 @@ //姝e悜 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(); } -- Gitblit v1.8.0