From 944b87b6bcccb095cd73f13f4410fb20faf48f74 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期三, 25 十二月 2019 11:21:06 +0800 Subject: [PATCH] 2019.12.25 --- ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs | 176 +++++++++++++++++++++++----------------------------------- 1 files changed, 70 insertions(+), 106 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs index 7c32d18..10cf90f 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs @@ -38,6 +38,14 @@ /// 鍒楄〃鎺т欢 /// </summary> private VerticalListControl listView = null; + /// <summary> + /// 寮�闄愪綅鐨勮繘搴︽潯 + /// </summary> + private HorizontalSeekBar openSeekBar = null; + /// <summary> + /// 鍚堥檺浣嶇殑杩涘害鏉� + /// </summary> + private HorizontalSeekBar closeSeekBar = null; #endregion @@ -135,7 +143,7 @@ listText.Add(Language.StringByID(R.MyInternationalizationString.uForwardDirection));//姝e悜 listText.Add(Language.StringByID(R.MyInternationalizationString.uReverseDirection));//鍙嶅悜 - var form = new BottomDialogSelectForm(); + var form = new BottomItemSelectForm(); form.AddForm(Language.StringByID(R.MyInternationalizationString.uDirectionSelect), listText, nowSelectNo); form.FinishSelectEvent += async (index) => { @@ -216,17 +224,17 @@ btnProgress1.Text = progressValue + "%"; frameBack.AddChidren(btnProgress1); //杩涘害鏉� - var seekBar = new HorizontalSeekBar(); - seekBar.Y = btnProgressView.Bottom + Application.GetRealHeight(46); - seekBar.Gravity = Gravity.CenterHorizontal; - seekBar.Width = Application.GetRealWidth(962); - seekBar.Height = Application.GetRealHeight(84); - seekBar.Max = 100; - seekBar.BackgroundColor = 0xfff5f5f5; - seekBar.ThumbColor = Common.ZigbeeColor.Current.GXCButtonBlueColor; - seekBar.ProgressColor = 0xff288bfd; - seekBar.Progress = progressValue; - frameBack.AddChidren(seekBar); + this.openSeekBar = new HorizontalSeekBar(); + 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.Progress = progressValue; + frameBack.AddChidren(openSeekBar); var btnTemp1 = new NormalViewControl(200, 50, true); btnTemp1.X = ControlCommonResourse.XXLeft; @@ -254,10 +262,16 @@ int waitTime = 4;//500姣涓哄崟浣� bool startWait = false; bool checking = false; - seekBar.ProgressChanged += (sender, value) => + openSeekBar.ProgressChanged += (sender, value) => { //鍊肩户缁敼鍙�,鍒欑瓑寰呮椂闂磋繕鍘� waitTime = 4; + //寮�闄愪綅涓嶈兘澶т簬鍚堥檺浣� + if (value > closeSeekBar.Progress) + { + openSeekBar.Progress = closeSeekBar.Progress; + return; + } if (checking == false) { startWait = true; @@ -269,7 +283,7 @@ }; HdlThreadLogic.Current.RunThread(async () => { - while (seekBar.Parent != null) + while (openSeekBar.Parent != null) { if (startWait == false) { @@ -285,7 +299,7 @@ startWait = false; checking = true; - var value = seekBar.Progress; + var value = curtainData.OpenLimitPersent; if (oldValue == value) { //鐩稿悓鏁板�� @@ -311,39 +325,6 @@ } } }); - - //var oldTime = DateTime.Now; - //var oldValue = 0; - //seekBar.MouseUpEventHandler += async (sender, e) => - //{ - // if ((DateTime.Now - oldTime).TotalSeconds <= 1) - // { - // //鏈�灏戦渶瑕�2绉掗棿闅� - // return; - // } - // var value = seekBar.Progress; - // if (oldValue == value) - // { - // //鐩稿悓鏁板�� - // return; - // } - // oldValue = value; - // oldTime = DateTime.Now; - - // if (curtainData.DeleteOpenLimit == true) - // { - // //閲嶇疆寮�闄愪綅鐐� - // var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.UpLimit); - // if (result == false) - // { - // return; - // } - // curtainData.DeleteOpenLimit = false; - // } - // receiveUplimit = "1"; - // //灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣� - // curtainDevice.WcdGoToTiltValue(value); - //}; } /// <summary> @@ -370,17 +351,17 @@ btnProgress1.Text = progressValue + "%"; frameBack.AddChidren(btnProgress1); //杩涘害鏉� - var seekBar = new HorizontalSeekBar(); - seekBar.Y = btnProgressView.Bottom + Application.GetRealHeight(46); - seekBar.Gravity = Gravity.CenterHorizontal; - seekBar.Width = Application.GetRealWidth(962); - seekBar.Height = Application.GetRealHeight(84); - seekBar.Max = 100; - seekBar.BackgroundColor = 0xfff5f5f5; - seekBar.ThumbColor = Common.ZigbeeColor.Current.GXCButtonBlueColor; - seekBar.ProgressColor = 0xff288bfd; - seekBar.Progress = progressValue; - frameBack.AddChidren(seekBar); + this.closeSeekBar = new HorizontalSeekBar(); + 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.Progress = progressValue; + frameBack.AddChidren(closeSeekBar); var btnTemp1 = new NormalViewControl(200, 50, true); btnTemp1.X = ControlCommonResourse.XXLeft; @@ -408,10 +389,16 @@ int waitTime = 4;//500姣涓哄崟浣� bool startWait = false; bool checking = false; - seekBar.ProgressChanged += (sender, value) => + closeSeekBar.ProgressChanged += (sender, value) => { //鍊肩户缁敼鍙�,鍒欑瓑寰呮椂闂磋繕鍘� waitTime = 4; + //鍚堥檺浣嶄笉鑳藉皬浜庡悎闄愪綅 + if (value < openSeekBar.Progress) + { + closeSeekBar.Progress = openSeekBar.Progress; + return; + } if (checking == false) { startWait = true; @@ -423,7 +410,7 @@ }; HdlThreadLogic.Current.RunThread(async () => { - while (seekBar.Parent != null) + while (closeSeekBar.Parent != null) { if (startWait == false) { @@ -439,7 +426,7 @@ startWait = false; checking = true; - var value = seekBar.Progress; + var value = curtainData.CloseLimitPersent; if (oldValue == value) { //鐩稿悓鏁板�� @@ -465,39 +452,6 @@ } } }); - - //var oldTime = DateTime.Now; - //var oldValue = 0; - //seekBar.MouseUpEventHandler += async (sender, e) => - //{ - // if ((DateTime.Now - oldTime).TotalSeconds <= 1) - // { - // //鏈�灏戦渶瑕�2绉掗棿闅� - // return; - // } - // var value = seekBar.Progress; - // if (oldValue == value) - // { - // //鐩稿悓鏁板�� - // return; - // } - // oldValue = value; - // oldTime = DateTime.Now; - - // if (curtainData.DeleteCloseLimit == true) - // { - // //閲嶇疆鍚堥檺浣嶇偣 - // var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.DownLimit); - // if (result == false) - // { - // return; - // } - // curtainData.DeleteCloseLimit = false; - // } - // receiveDownLimit = "1"; - // //灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣� - // curtainDevice.WcdGoToTiltValue(value); - //}; } #endregion @@ -558,7 +512,7 @@ bool receiptData = false; string mainkeys = LocalDevice.Current.GetDeviceMainKeys(curtainDevice); - HdlDeviceAttributeLogic.Current.AddAttributeEvent("CurtainDeviceAttribute", "DeviceStatusReport", (device) => + HdlGatewayReceiveLogic.Current.AddAttributeEvent("CurtainDeviceAttribute", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (device) => { string checkKey = LocalDevice.Current.GetDeviceMainKeys(device); if (mainkeys != checkKey || device.DeviceStatusReport.CluterID != 258) @@ -622,7 +576,7 @@ return false; } //绉婚櫎鐩戝惉 - HdlDeviceAttributeLogic.Current.RemoveEvent("CurtainDeviceAttribute"); + HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute"); //澶囦唤绐楀笜鏁版嵁 if (this.backupCurtainData == true) @@ -651,12 +605,12 @@ /// </summary> private void ReceiveLimitData() { - if (HdlDeviceAttributeLogic.Current.IsEsixt("ReceiveLimitData") == true) + if (HdlGatewayReceiveLogic.Current.IsEsixt("ReceiveLimitData") == true) { - HdlDeviceAttributeLogic.Current.RemoveEvent("ReceiveLimitData"); + HdlGatewayReceiveLogic.Current.RemoveEvent("ReceiveLimitData"); } string mainkeys = LocalDevice.Current.GetDeviceMainKeys(curtainDevice); - HdlDeviceAttributeLogic.Current.AddAttributeEvent("ReceiveLimitData", "DeviceStatusReport", (device) => + HdlGatewayReceiveLogic.Current.AddAttributeEvent("ReceiveLimitData", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (device) => { string checkKey = LocalDevice.Current.GetDeviceMainKeys(device); if (mainkeys != checkKey || device.DeviceStatusReport.CluterID != 258) @@ -678,28 +632,38 @@ 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 () => { //鎵ц纭鍙婅鐩栦笂闄愪綅鐐� - await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.UpLimit, + 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 () => { //鎵ц纭鍙婅鐩栧悎闄愪綅鐐� - await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit, + var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit, curtainData.OpenLimitPersent, curtainData.CloseLimitPersent); + if (result == true) + { + curtainData.DeleteCloseLimit = true; + } }); } } @@ -715,14 +679,14 @@ /// <summary> /// 鐣岄潰鍏抽棴 /// </summary> - public override void CloseForm() + public override void CloseFormBefore() { - HdlDeviceAttributeLogic.Current.RemoveEvent("CurtainDeviceAttribute"); - HdlDeviceAttributeLogic.Current.RemoveEvent("ReceiveLimitData"); + HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute"); + HdlGatewayReceiveLogic.Current.RemoveEvent("ReceiveLimitData"); UserView.HomePage.Instance.ScrollEnabled = true; - base.CloseForm(); + base.CloseFormBefore(); } #endregion -- Gitblit v1.8.0