From c47c3ec2488961b3a006aaebcb03dba582f8b19b Mon Sep 17 00:00:00 2001 From: WJC <wjc@hdlchina.com.cn> Date: 星期四, 12 三月 2020 17:08:42 +0800 Subject: [PATCH] 2020-03-12-1 --- ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs | 502 +++++++++++++++++++++++++++++++++---------------------- 1 files changed, 301 insertions(+), 201 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs index 10cf90f..cd6cbe0 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs @@ -23,13 +23,17 @@ /// </summary> private CurtainData curtainData = null; /// <summary> - /// 鍏佽鎺ユ敹涓婇檺浣�(0:涓嶅厑璁� 1:鍏佽) + /// 鎺ユ敹寮�闄愪綅 false:娌℃湁鎺ユ敹鍒� true:宸茬粡鎺ユ敹鍒� /// </summary> - private string receiveUplimit = "0"; + private bool receiveOpenlimit = false; /// <summary> - /// 鍏佽鎺ユ敹涓嬮檺浣�(0:涓嶅厑璁� 1:鍏佽) + /// 鎺ユ敹鍚堥檺浣� false:娌℃湁鎺ユ敹鍒� true:宸茬粡鎺ユ敹鍒� /// </summary> - private string receiveDownLimit = "0"; + private bool receiveCloseLimit = false; + /// <summary> + /// 鍙戦�佸尯鍒� 1:寮�闄愪綅 2:鍚堥檺浣� + /// </summary> + private int sendDiv = 0; /// <summary> /// 鏄惁澶囦唤绐楀笜鏁版嵁 /// </summary> @@ -41,11 +45,11 @@ /// <summary> /// 寮�闄愪綅鐨勮繘搴︽潯 /// </summary> - private HorizontalSeekBar openSeekBar = null; + private SeekBarControl openSeekBar = null; /// <summary> /// 鍚堥檺浣嶇殑杩涘害鏉� /// </summary> - private HorizontalSeekBar closeSeekBar = null; + private SeekBarControl closeSeekBar = null; #endregion @@ -57,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; @@ -95,23 +99,51 @@ listView.Height = bodyFrameLayout.Height; bodyFrameLayout.AddChidren(listView); - //娣诲姞鏂瑰悜琛� - this.AddDirectionRow(); - //娣诲姞闄愪綅琛� - this.AddLimitRow(); - //娣诲姞閲嶇疆鐢垫満琛� - this.AddElectricalMachineryRow(); - //淇濆瓨 - var btnSave = new BottomClickButton(); - btnSave.TextID = R.MyInternationalizationString.uSave; - bodyFrameLayout.AddChidren(btnSave); - btnSave.ButtonClickEvent += (sender, e) => + //瀵艰建闀垮害涓�0鏃� + if (curtainData.CurtainLength <= 0) { - //杩欎釜淇濆瓨娌″暐鎰忎箟 - this.CloseForm(); - }; - //闄愪綅鏁版嵁鎺ユ敹 - this.ReceiveLimitData(); + //鐢垫満鏁版嵁寮傚父,璇烽噸缃數鏈� + this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uCurtainDataIsErrorPleaseResetCurtain)); + try + { + //璁惧寮傚父琛ユ晳 -> 娣诲姞閲嶇疆鐢垫満琛� + this.AddElectricalMachineryRow(); + return; + } + catch (Exception ex2) + { + HdlLogLogic.Current.WriteLog(ex2, "寮�鍚堝笜琛ユ晳寮傚父1"); + return; + } + } + + try + { + //娣诲姞鏂瑰悜琛� + this.AddDirectionRow(); + //娣诲姞闄愪綅琛� + this.AddLimitRow(); + //娣诲姞閲嶇疆鐢垫満琛� + this.AddElectricalMachineryRow(); + + //闄愪綅鏁版嵁鎺ユ敹 + this.ReceiveLimitData(); + } + catch (Exception ex) + { + //Log鍑哄姏 + string msg = "褰撳墠婵�娲荤殑鐣岄潰[" + UserCenterResourse.NowActionFormID + "]"; + HdlLogLogic.Current.WriteLog(ex, msg); + //鐢垫満鏁版嵁寮傚父,璇烽噸缃數鏈� + this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uCurtainDataIsErrorPleaseResetCurtain)); + try + { + this.listView.RemoveAll(); + //璁惧寮傚父琛ユ晳 -> 娣诲姞閲嶇疆鐢垫満琛� + this.AddElectricalMachineryRow(); + } + catch (Exception ex2) { HdlLogLogic.Current.WriteLog(ex2, "寮�鍚堝笜琛ユ晳寮傚父2"); } + } }); } @@ -170,7 +202,7 @@ private void AddLimitRow() { var frameBack = new FrameLayout(); - frameBack.Height = Application.GetRealHeight(679); + frameBack.Height = Application.GetRealHeight(956); var rowLimit = new FrameRowControl(listView.rowSpace / 2); rowLimit.UseClickStatu = false; @@ -181,14 +213,14 @@ var btnRinght = rowLimit.AddMostRightEmptyIcon(58, 58); rowLimit.ChangedChidrenBindMode(btnRinght, ChidrenBindMode.NotBind); btnRinght.UseClickStatu = false; - btnRinght.UnSelectedImagePath = "Item/Next.png"; + btnRinght.UnSelectedImagePath = "Item/RightNext.png"; btnRinght.SelectedImagePath = "Item/Down.png"; btnRinght.IsSelected = true; btnRinght.ButtonClickEvent += (sender, e) => { btnRinght.IsSelected = !btnRinght.IsSelected; //灞曞紑鎶樺彔 - frameBack.Height = frameBack.Height > 10 ? 0 : Application.GetRealHeight(679); + frameBack.Height = frameBack.Height > 10 ? 0 : Application.GetRealHeight(956); }; //搴曠嚎 rowLimit.AddBottomLine(); @@ -200,6 +232,10 @@ this.AddCloseLimitProgress(frameBack); } + #endregion + + #region 鈻� 寮�闄愪綅琛宊__________________________ + /// <summary> /// 娣诲姞寮�闄愪綅杩涘害鏉� /// </summary> @@ -209,7 +245,7 @@ //寮�闄愪綅 var btnProgressView = new NormalViewControl(200, 50, true); btnProgressView.X = ControlCommonResourse.XXLeft; - btnProgressView.Y = Application.GetRealHeight(60); + btnProgressView.Y = Application.GetRealHeight(78); btnProgressView.TextSize = 12; btnProgressView.TextColor = UserCenterColor.Current.TextGrayColor1; btnProgressView.TextID = R.MyInternationalizationString.uOpenLimit; @@ -224,15 +260,9 @@ btnProgress1.Text = progressValue + "%"; frameBack.AddChidren(btnProgress1); //杩涘害鏉� - this.openSeekBar = new HorizontalSeekBar(); + this.openSeekBar = new SeekBarControl(965); openSeekBar.Y = btnProgressView.Bottom + Application.GetRealHeight(46); - openSeekBar.Gravity = Gravity.CenterHorizontal; - openSeekBar.Width = Application.GetRealWidth(962); - openSeekBar.Height = Application.GetRealHeight(84); - openSeekBar.Max = 100; - openSeekBar.BackgroundColor = 0xfff5f5f5; - openSeekBar.ThumbColor = Common.ZigbeeColor.Current.GXCButtonBlueColor; - openSeekBar.ProgressColor = 0xff288bfd; + openSeekBar.ProgressBarColor = 0xff288bfd; openSeekBar.Progress = progressValue; frameBack.AddChidren(openSeekBar); @@ -254,78 +284,127 @@ //绾� var btnLine = new NormalViewControl(frameBack.Width - ControlCommonResourse.XXLeft * 2, ControlCommonResourse.BottomLineHeight, false); btnLine.X = ControlCommonResourse.XXLeft; - btnLine.Y = btnTemp2.Bottom + Application.GetRealHeight(69); + btnLine.Y = btnTemp2.Bottom + Application.GetRealHeight(156); btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine; frameBack.AddChidren(btnLine); - int oldValue = progressValue; - int waitTime = 4;//500姣涓哄崟浣� - bool startWait = false; - bool checking = false; - openSeekBar.ProgressChanged += (sender, value) => + //鍑忓彿 + var btnMinus = new IconViewControl(104); + btnMinus.UseClickStatu = true; + btnMinus.X = Application.GetRealWidth(847); + btnMinus.Y = Application.GetRealHeight(46); + btnMinus.UnSelectedImagePath = "Item/MinusSign2.png"; + btnMinus.SelectedImagePath = "Item/MinusSign2Selected.png"; + frameBack.AddChidren(btnMinus); + btnMinus.ButtonClickEvent += (sender, e) => { - //鍊肩户缁敼鍙�,鍒欑瓑寰呮椂闂磋繕鍘� - waitTime = 4; + if (openSeekBar.Progress <= 0) + { + return; + } + openSeekBar.Progress -= 5; + openSeekBar.ProgressChangedEvent(1, openSeekBar.Progress); + }; + + //鍔犲彿 + var btnPlus = new IconViewControl(104); + btnPlus.UseClickStatu = true; + btnPlus.X = btnMinus.Right; + btnPlus.Y = btnMinus.Y; + btnPlus.UnSelectedImagePath = "Item/PlusSign2.png"; + btnPlus.SelectedImagePath = "Item/PlusSign2Selected.png"; + frameBack.AddChidren(btnPlus); + btnPlus.ButtonClickEvent += (sender, e) => + { + if (openSeekBar.Progress >= 100) + { + return; + } + openSeekBar.Progress += 5; + openSeekBar.ProgressChangedEvent(1, openSeekBar.Progress); + }; + + //淇濆瓨 + var btnSave = new NormalViewControl(150, 60, true); + btnSave.X = Application.GetRealWidth(906); + btnSave.Y = btnTemp1.Bottom + Application.GetRealHeight(68); + btnSave.TextAlignment = TextAlignment.Center; + btnSave.TextID = R.MyInternationalizationString.uSave; + btnSave.TextColor = UserCenterColor.Current.TextOrangeColor; + frameBack.AddChidren(btnSave); + btnSave.ButtonClickEvent += (sender, e) => + { + if (this.receiveOpenlimit == true) + { + //纭寮�闄愪綅鐐� + this.SaveOpenLimit(); + } + }; + + int oldProValue = curtainData.OpenLimitPersent; + openSeekBar.ProgressChangedEvent += (div, value) => + { //寮�闄愪綅涓嶈兘澶т簬鍚堥檺浣� if (value > closeSeekBar.Progress) { openSeekBar.Progress = closeSeekBar.Progress; return; } - if (checking == false) - { - startWait = true; - } - btnProgress1.Text = value + "%"; //鏁版嵁鍙樻洿,鐧惧垎姣� curtainData.OpenLimitPersent = value; }; + HdlThreadLogic.Current.RunThread(async () => { + //澶勭悊涓� + bool checking = false; while (openSeekBar.Parent != null) { - if (startWait == false) + int nowValue = curtainData.OpenLimitPersent; + if (oldProValue == nowValue || checking == true) { - await Task.Delay(200); + //鍊间笉绛夋墠澶勭悊 + await Task.Delay(500); continue; } - //寮�鍚�兼敼鍙樼瓑寰� - await Task.Delay(500); - waitTime--; - if (waitTime <= 0) - { - //濡傛灉2绉掑唴鍊间笉鍐嶆敼鍙�,鍒欒繘琛屽垽鏂� - startWait = false; - checking = true; + oldProValue = nowValue; + checking = true; - var value = curtainData.OpenLimitPersent; - if (oldValue == value) - { - //鐩稿悓鏁板�� - checking = false; - continue; - } - oldValue = value; - if (curtainData.DeleteOpenLimit == true) - { - //閲嶇疆寮�闄愪綅鐐� - var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.UpLimit); - if (result == false) - { - checking = false; - continue; - } - curtainData.DeleteOpenLimit = false; - } - receiveUplimit = "1"; - //灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣� - curtainDevice.WcdGoToTiltValue(value); - checking = false; - } + //灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣� + this.sendDiv = 1; + curtainDevice.WcdGoToTiltValue(nowValue); + checking = false; } }); } + + /// <summary> + /// 纭寮�闄愪綅鐐� + /// </summary> + private void SaveOpenLimit() + { + //纭褰撳墠浣嶇疆涓哄紑闄愪綅? + string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainOpenLimitMsg); + this.ShowMassage(ShowMsgType.Confirm, msg, async () => + { + decimal openValue = ((decimal)curtainData.OpenLimitPersent / 100) * curtainData.CurtainLength; + decimal closeValue = ((decimal)curtainData.CloseLimitPersent / 100) * curtainData.CurtainLength; + if (openValue < 0) { openValue = 0; } + if (closeValue < 0) { closeValue = curtainData.CurtainLength; } + //鎵ц纭鍙婅鐩栦笂闄愪綅鐐� + var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.UpLimit, + (int)openValue, (int)closeValue); + if (result == true) + { + this.receiveOpenlimit = false; + } + }); + } + + #endregion + + #region 鈻� 鍚堥檺浣嶈___________________________ /// <summary> /// 娣诲姞鍚堥檺浣嶈繘搴︽潯 @@ -336,7 +415,7 @@ //鍚堥檺浣� var btnProgressView = new NormalViewControl(200, 50, true); btnProgressView.X = ControlCommonResourse.XXLeft; - btnProgressView.Y = Application.GetRealHeight(397); + btnProgressView.Y = Application.GetRealHeight(536); btnProgressView.TextSize = 12; btnProgressView.TextColor = UserCenterColor.Current.TextGrayColor1; btnProgressView.TextID = R.MyInternationalizationString.uCloseLimit; @@ -351,15 +430,9 @@ btnProgress1.Text = progressValue + "%"; frameBack.AddChidren(btnProgress1); //杩涘害鏉� - this.closeSeekBar = new HorizontalSeekBar(); + this.closeSeekBar = new SeekBarControl(965); closeSeekBar.Y = btnProgressView.Bottom + Application.GetRealHeight(46); - closeSeekBar.Gravity = Gravity.CenterHorizontal; - closeSeekBar.Width = Application.GetRealWidth(962); - closeSeekBar.Height = Application.GetRealHeight(84); - closeSeekBar.Max = 100; - closeSeekBar.BackgroundColor = 0xfff5f5f5; - closeSeekBar.ThumbColor = Common.ZigbeeColor.Current.GXCButtonBlueColor; - closeSeekBar.ProgressColor = 0xff288bfd; + closeSeekBar.ProgressBarColor = 0xff288bfd; closeSeekBar.Progress = progressValue; frameBack.AddChidren(closeSeekBar); @@ -381,75 +454,121 @@ //绾� var btnLine = new NormalViewControl(frameBack.Width - ControlCommonResourse.XXLeft * 2, ControlCommonResourse.BottomLineHeight, false); btnLine.X = ControlCommonResourse.XXLeft; - btnLine.Y = btnTemp2.Bottom + Application.GetRealHeight(69); + btnLine.Y = btnTemp2.Bottom + Application.GetRealHeight(156); btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine; frameBack.AddChidren(btnLine); - int oldValue = progressValue; - int waitTime = 4;//500姣涓哄崟浣� - bool startWait = false; - bool checking = false; - closeSeekBar.ProgressChanged += (sender, value) => + //鍑忓彿 + var btnMinus = new IconViewControl(104); + btnMinus.UseClickStatu = true; + btnMinus.X = Application.GetRealWidth(847); + btnMinus.Y = Application.GetRealHeight(504); + btnMinus.UnSelectedImagePath = "Item/MinusSign2.png"; + btnMinus.SelectedImagePath = "Item/MinusSign2Selected.png"; + frameBack.AddChidren(btnMinus); + btnMinus.ButtonClickEvent += (sender, e) => { - //鍊肩户缁敼鍙�,鍒欑瓑寰呮椂闂磋繕鍘� - waitTime = 4; - //鍚堥檺浣嶄笉鑳藉皬浜庡悎闄愪綅 - if (value < openSeekBar.Progress) + if (closeSeekBar.Progress <= 0) { + return; + } + closeSeekBar.Progress -= 5; + closeSeekBar.ProgressChangedEvent(1, closeSeekBar.Progress); + }; + + //鍔犲彿 + var btnPlus = new IconViewControl(104); + btnPlus.UseClickStatu = true; + btnPlus.X = btnMinus.Right; + btnPlus.Y = btnMinus.Y; + btnPlus.UnSelectedImagePath = "Item/PlusSign2.png"; + btnPlus.SelectedImagePath = "Item/PlusSign2Selected.png"; + frameBack.AddChidren(btnPlus); + btnPlus.ButtonClickEvent += (sender, e) => + { + if (closeSeekBar.Progress >= 100) + { + return; + } + closeSeekBar.Progress += 5; + closeSeekBar.ProgressChangedEvent(1, closeSeekBar.Progress); + }; + + //淇濆瓨 + var btnSave = new NormalViewControl(150, 60, true); + btnSave.X = Application.GetRealWidth(906); + btnSave.Y = btnTemp1.Bottom + Application.GetRealHeight(68); + btnSave.TextAlignment = TextAlignment.Center; + btnSave.TextID = R.MyInternationalizationString.uSave; + btnSave.TextColor = UserCenterColor.Current.TextOrangeColor; + frameBack.AddChidren(btnSave); + btnSave.ButtonClickEvent += (sender, e) => + { + if (this.receiveCloseLimit == true) + { + //淇濆瓨鍚堥檺浣嶇偣 + this.SaveCloseLimit(); + } + }; + + int oldProValue = curtainData.CloseLimitPersent; + closeSeekBar.ProgressChangedEvent += (div, value) => + { + if (value < curtainData.OpenLimitPersent) + { + //鍚堥檺浣嶄笉鑳藉皬浜庡悎闄愪綅 closeSeekBar.Progress = openSeekBar.Progress; return; } - if (checking == false) - { - startWait = true; - } - btnProgress1.Text = value + "%"; //鏁版嵁鍙樻洿,鐧惧垎姣� curtainData.CloseLimitPersent = value; }; + HdlThreadLogic.Current.RunThread(async () => { + //澶勭悊涓� + bool checking = false; while (closeSeekBar.Parent != null) { - if (startWait == false) + int nowValue = curtainData.CloseLimitPersent; + if (oldProValue == nowValue || checking == true) { - await Task.Delay(200); + //鍊间笉绛夋墠澶勭悊 + await Task.Delay(500); continue; } - //寮�鍚�兼敼鍙樼瓑寰� - await Task.Delay(500); - waitTime--; - if (waitTime <= 0) - { - //濡傛灉2绉掑唴鍊间笉鍐嶆敼鍙�,鍒欒繘琛屽垽鏂� - startWait = false; - checking = true; + checking = true; + oldProValue = nowValue; - var value = curtainData.CloseLimitPersent; - if (oldValue == value) - { - //鐩稿悓鏁板�� - checking = false; - continue; - } - oldValue = value; - if (curtainData.DeleteCloseLimit == true) - { - //閲嶇疆鍚堥檺浣嶇偣 - var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.DownLimit); - if (result == false) - { - checking = false; - continue; - } - curtainData.DeleteCloseLimit = false; - } - receiveDownLimit = "1"; - //灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣� - curtainDevice.WcdGoToTiltValue(value); - checking = false; - } + //灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣� + this.sendDiv = 2; + curtainDevice.WcdGoToTiltValue(nowValue); + checking = false; + } + }); + } + + /// <summary> + /// 淇濆瓨鍚堥檺浣嶇偣 + /// </summary> + private void SaveCloseLimit() + { + //纭褰撳墠浣嶇疆涓哄悎闄愪綅? + string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainCloseLimitMsg); + this.ShowMassage(ShowMsgType.Confirm, msg, async () => + { + decimal openValue = ((decimal)curtainData.OpenLimitPersent / 100) * curtainData.CurtainLength; + decimal closeValue = ((decimal)curtainData.CloseLimitPersent / 100) * curtainData.CurtainLength; + if (openValue < 0) { openValue = 0; } + if (closeValue < 0) { closeValue = curtainData.CurtainLength; } + //鎵ц纭鍙婅鐩栦笂闄愪綅鐐� + var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit, + (int)openValue, (int)closeValue); + + if (result == true) + { + this.receiveCloseLimit = false; } }); } @@ -476,14 +595,39 @@ msg = msg.Replace("{0}", "\r\n"); this.ShowMassage(ShowMsgType.Confirm, msg, () => { + //寮�鍚繘搴︽潯 + ProgressFormBar.Current.Start(); + //姝e湪閲嶇疆鐢垫満 + ProgressFormBar.Current.SetMsg(Language.StringByID(R.MyInternationalizationString.uElectricalMachineryResetting)); + //閲嶇疆绐楀笜 HdlThreadLogic.Current.RunThread(async () => { - //閲嶇疆绐楀笜 var result = await HdlDeviceCurtainLogic.Current.RestoreCurtain(curtainDevice); if (result == false) { + //鍏抽棴杩涘害鏉� + ProgressFormBar.Current.Close(); return; } + + //姣�10鐨勯暱搴﹀ぇ姒傛槸2绉�,澶氶鐣�1娆″嚭鏉� + int waitCount = ((curtainData.CurtainLength / 10) + 1) * 3; + if (waitCount < 12) + { + waitCount = 12; + } + + int timeCount = 0; + while (timeCount <= waitCount) + { + //杩涘害鏉″�� + ProgressFormBar.Current.SetValue(timeCount, waitCount); + timeCount++; + System.Threading.Thread.Sleep(1000); + } + //鍏抽棴杩涘害鏉� + ProgressFormBar.Current.Close(); + //鑾峰彇鏁版嵁鍚�,澶囦唤绐楀笜鏁版嵁 this.backupCurtainData = true; //閲嶆柊鍒濆鍖栫晫闈� @@ -507,8 +651,9 @@ this.ShowProgressBar(); this.curtainData = new CurtainData(); - this.receiveUplimit = "0"; - this.receiveDownLimit = "0"; + this.receiveOpenlimit = false; + this.receiveCloseLimit = false; + this.sendDiv = 0; bool receiptData = false; string mainkeys = LocalDevice.Current.GetDeviceMainKeys(curtainDevice); @@ -579,7 +724,7 @@ HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute"); //澶囦唤绐楀笜鏁版嵁 - if (this.backupCurtainData == true) + if (this.backupCurtainData == true && curtainData.CurtainLength > 0) { this.backupCurtainData = false; HdlThreadLogic.Current.RunThread(async () => @@ -587,7 +732,7 @@ //鏂瑰悜澶囦唤 await HdlDeviceCurtainLogic.Current.BackupCurtainDirection(curtainDevice, curtainData.Direction); //闄愪綅澶囦唤 - int uplimit= (int)(curtainData.OpenLimitValue / (curtainData.CurtainLength * 1.0) * 100); + int uplimit = (int)(curtainData.OpenLimitValue / (curtainData.CurtainLength * 1.0) * 100); int downlimit = (int)(curtainData.CloseLimitValue / (curtainData.CurtainLength * 1.0) * 100); await HdlDeviceCurtainLogic.Current.BackupCurtainLimitPoint(curtainDevice, uplimit, downlimit); }); @@ -617,55 +762,20 @@ { return; } - lock (receiveUplimit) + foreach (var attriBute in device.DeviceStatusReport.AttriBute) { - if (receiveUplimit == "0" && receiveDownLimit == "0") + //绐楀笜鐧惧垎姣旀帹閫� + if (attriBute.AttributeId == 8) { - return; - } - foreach (var attriBute in device.DeviceStatusReport.AttriBute) - { - //绐楀笜鐧惧垎姣旀帹閫� - if (attriBute.AttributeId == 8) + //寮�闄愪綅 + if (sendDiv == 1) { - //涓婇檺浣� - if (receiveUplimit == "1") - { - receiveUplimit = "0"; - openSeekBar.Progress = curtainData.OpenLimitPersent; - //纭褰撳墠浣嶇疆{0}涓哄紑闄愪綅? - string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainOpenLimitMsg); - msg = msg.Replace("{0}", curtainData.OpenLimitPersent + "%"); - this.ShowMassage(ShowMsgType.Confirm, msg, async () => - { - //鎵ц纭鍙婅鐩栦笂闄愪綅鐐� - var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.UpLimit, - curtainData.OpenLimitPersent, curtainData.CloseLimitPersent); - if (result == true) - { - curtainData.DeleteOpenLimit = true; - } - }); - } - //鍚堥檺浣� - else if (receiveDownLimit == "1") - { - receiveDownLimit = "0"; - closeSeekBar.Progress = curtainData.CloseLimitPersent; - //纭褰撳墠浣嶇疆{0}涓哄悎闄愪綅? - string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainCloseLimitMsg); - msg = msg.Replace("{0}", curtainData.CloseLimitPersent + "%"); - this.ShowMassage(ShowMsgType.Confirm, msg, async () => - { - //鎵ц纭鍙婅鐩栧悎闄愪綅鐐� - var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit, - curtainData.OpenLimitPersent, curtainData.CloseLimitPersent); - if (result == true) - { - curtainData.DeleteCloseLimit = true; - } - }); - } + receiveOpenlimit = true; + } + //鍚堥檺浣� + else if (sendDiv == 2) + { + receiveCloseLimit = true; } } } @@ -684,8 +794,6 @@ HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute"); HdlGatewayReceiveLogic.Current.RemoveEvent("ReceiveLimitData"); - UserView.HomePage.Instance.ScrollEnabled = true; - base.CloseFormBefore(); } @@ -702,14 +810,6 @@ /// false:鐢垫満鏂瑰悜姝e悜锛泃rue:鐢垫満鏂瑰悜鍙嶅悜 /// </summary> public bool Direction = false; - /// <summary> - /// 鏄惁閲嶇疆寮�闄愪綅鐐� - /// </summary> - public bool DeleteOpenLimit = true; - /// <summary> - /// 鏄惁閲嶇疆鍚堥檺浣嶇偣 - /// </summary> - public bool DeleteCloseLimit = true; /// <summary> /// 寮�闄愪綅鐨勫�� /// </summary> -- Gitblit v1.8.0