From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs |  134 +++++++++++++++++++++++++++-----------------
 1 files changed, 83 insertions(+), 51 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs
index e7a78d2..652c833 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs
@@ -120,11 +120,11 @@
                 listText.Add(Language.StringByID(R.MyInternationalizationString.uReverseDirection));//鍙嶅悜
 
                 var form = new BottomItemSelectForm();
-                form.AddForm(Language.StringByID(R.MyInternationalizationString.uDirectionSelect), listText, nowSelectNo);
-                form.FinishSelectEvent += async (index) =>
+                form.AddForm(Language.StringByID(R.MyInternationalizationString.uDirectionSelect), listText, null, nowSelectNo);
+                form.FinishSelectEvent += (index) =>
                 {
                     //鍙樻洿鏂瑰悜
-                    var result = await HdlDeviceCurtainLogic.Current.SetCurtainDirection(curtainDevice, index == 0 ? false : true);
+                    var result = HdlDeviceCurtainLogic.Current.SetCurtainDirection(curtainDevice, index == 0 ? false : true);
                     if (result == false)
                     {
                         return;
@@ -157,7 +157,7 @@
             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) =>
@@ -185,55 +185,55 @@
             var frameIcon = new FrameLayout();
             frameIcon.X = Application.GetRealWidth(228);
             frameIcon.Y = Application.GetRealHeight(121);
-            frameIcon.Width = Application.GetMinRealAverage(265);
-            frameIcon.Height= Application.GetMinRealAverage(495);
+            frameIcon.Width = this.GetPictrueRealSize(265);
+            frameIcon.Height= this.GetPictrueRealSize(495);
             frameIcon.BackgroundImagePath = "Item/DeviceLimitGround.png";
             frameBack.AddChidren(frameIcon);
 
-            var frameIconback = new FrameLayoutControl();
-            frameIconback.Height = Application.GetMinRealAverage(144);
-            frameIconback.Width = Application.GetMinRealAverage(144);
-            frameIconback.Radius = (uint)Application.GetMinRealAverage(144) / 2;
+            var frameIconback = new FrameLayoutStatuControl();
+            frameIconback.Height = this.GetPictrueRealSize(144);
+            frameIconback.Width = this.GetPictrueRealSize(144);
+            frameIconback.Radius = (uint)this.GetPictrueRealSize(144) / 2;
             frameIconback.BackgroundColor = 0xffeff2fb;
             frameIconback.Gravity = Gravity.CenterHorizontal;
-            frameIconback.Y = Application.GetMinRealAverage(35);
+            frameIconback.Y = this.GetPictrueRealSize(35);
             frameIcon.AddChidren(frameIconback);
-            var btnIcon = new NormalViewControl(Application.GetMinRealAverage(69), Application.GetMinRealAverage(35), false);
+            var btnIcon = new NormalViewControl(this.GetPictrueRealSize(69), this.GetPictrueRealSize(35), false);
             btnIcon.UnSelectedImagePath = "Item/DownTriangle.png";
             btnIcon.Gravity = Gravity.Center;
-            frameIconback.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly);
+            frameIconback.AddChidren(btnIcon, ChidrenBindMode.BindEvent);
 
-            var frameText = new FrameLayoutControl();
-            frameText.Y= Application.GetMinRealAverage(265);
-            frameText.Height = Application.GetMinRealAverage(120);
+            var frameText = new FrameLayoutStatuControl();
+            frameText.Y= this.GetPictrueRealSize(265);
+            frameText.Height = this.GetPictrueRealSize(120);
             frameIcon.AddChidren(frameText);
 
             //纭畾
-            var btnOk = new NormalViewControl(frameIcon.Width, Application.GetMinRealAverage(60), false);
+            var btnOk = new NormalViewControl(frameIcon.Width, this.GetPictrueRealSize(60), false);
             btnOk.TextID = R.MyInternationalizationString.uConfirm1;
             btnOk.TextAlignment = TextAlignment.Center;
             btnOk.TextColor = UserCenterColor.Current.TextOrangeColor;
-            frameText.AddChidren(btnOk, ChidrenBindMode.BindEventOnly);
+            frameText.AddChidren(btnOk, ChidrenBindMode.BindEvent);
             //搴曠嚎
-            var btnLine1 = new NormalViewControl(Application.GetMinRealAverage(100), ControlCommonResourse.BottomLineHeight, false);
+            var btnLine1 = new NormalViewControl(this.GetPictrueRealSize(100), ControlCommonResourse.BottomLineHeight, false);
             btnLine1.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
             btnLine1.Gravity = Gravity.CenterHorizontal;
-            btnLine1.Y = btnOk.Bottom - Application.GetMinRealAverage(8);
+            btnLine1.Y = btnOk.Bottom - this.GetPictrueRealSize(8);
             frameText.AddChidren(btnLine1);
 
             //涓嬮檺浣�
-            var btnDown = new NormalViewControl(frameIcon.Width, Application.GetMinRealAverage(60), false);
+            var btnDown = new NormalViewControl(frameIcon.Width, this.GetPictrueRealSize(60), false);
             btnDown.TextID = R.MyInternationalizationString.uDownLimit;
             btnDown.Y = btnOk.Bottom;
             btnDown.TextAlignment = TextAlignment.Center;
             btnDown.TextColor = UserCenterColor.Current.TextOrangeColor;
-            frameText.AddChidren(btnDown, ChidrenBindMode.BindEventOnly);
+            frameText.AddChidren(btnDown, ChidrenBindMode.BindEvent);
 
             //搴曠嚎
-            var btnLine2 = new NormalViewControl(Application.GetMinRealAverage(124), ControlCommonResourse.BottomLineHeight, false);
+            var btnLine2 = new NormalViewControl(this.GetPictrueRealSize(124), ControlCommonResourse.BottomLineHeight, false);
             btnLine2.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
             btnLine2.Gravity = Gravity.CenterHorizontal;
-            btnLine2.Y = btnDown.Bottom - Application.GetMinRealAverage(8);
+            btnLine2.Y = btnDown.Bottom - this.GetPictrueRealSize(8);
             frameText.AddChidren(btnLine2);
 
             //鍥炬爣鐐瑰嚮
@@ -241,6 +241,11 @@
             {
                 curtainDevice.CurtainUpDownStopControl(1);
             };
+            //灞曠ず妯℃澘鎴栬�呰櫄鎷熶綇瀹�,鍒欐棤鏁�
+            if (Config.Instance.Home.IsShowTemplate == true || Config.Instance.Home.IsVirtually == true)
+            {
+                frameIconback.CanClick = false;
+            }
             //閲嶅啓鎺т欢鐐瑰嚮鏁堟灉
             frameIconback.SelectStatuEvent += (select) =>
             {
@@ -265,6 +270,11 @@
                     await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit, -1, -1);
                 });
             };
+            //灞曠ず妯℃澘鎴栬�呰櫄鎷熶綇瀹�,鍒欐棤鏁�
+            if (Config.Instance.Home.IsShowTemplate == true || Config.Instance.Home.IsVirtually == true)
+            {
+                frameText.CanClick = false;
+            }
             //閲嶅啓鎺т欢鐐瑰嚮鏁堟灉
             frameText.SelectStatuEvent += (select) =>
             {
@@ -294,55 +304,55 @@
             var frameIcon = new FrameLayout();
             frameIcon.X = Application.GetRealWidth(619);
             frameIcon.Y = Application.GetRealHeight(121);
-            frameIcon.Width = Application.GetMinRealAverage(265);
-            frameIcon.Height = Application.GetMinRealAverage(495);
+            frameIcon.Width = this.GetPictrueRealSize(265);
+            frameIcon.Height = this.GetPictrueRealSize(495);
             frameIcon.BackgroundImagePath = "Item/DeviceLimitGround.png";
             frameBack.AddChidren(frameIcon);
 
-            var frameIconback = new FrameLayoutControl();
-            frameIconback.Height = Application.GetMinRealAverage(144);
-            frameIconback.Width = Application.GetMinRealAverage(144);
-            frameIconback.Radius = (uint)Application.GetMinRealAverage(144) / 2;
+            var frameIconback = new FrameLayoutStatuControl();
+            frameIconback.Height = this.GetPictrueRealSize(144);
+            frameIconback.Width = this.GetPictrueRealSize(144);
+            frameIconback.Radius = (uint)this.GetPictrueRealSize(144) / 2;
             frameIconback.BackgroundColor = 0xffeff2fb;
             frameIconback.Gravity = Gravity.CenterHorizontal;
-            frameIconback.Y = Application.GetMinRealAverage(35);
+            frameIconback.Y = this.GetPictrueRealSize(35);
             frameIcon.AddChidren(frameIconback);
-            var btnIcon = new NormalViewControl(Application.GetMinRealAverage(69), Application.GetMinRealAverage(35), false);
+            var btnIcon = new NormalViewControl(this.GetPictrueRealSize(69), this.GetPictrueRealSize(35), false);
             btnIcon.UnSelectedImagePath = "Item/UpTriangle.png";
             btnIcon.Gravity = Gravity.Center;
-            frameIconback.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly);
+            frameIconback.AddChidren(btnIcon, ChidrenBindMode.BindEvent);
 
-            var frameText = new FrameLayoutControl();
-            frameText.Y = Application.GetMinRealAverage(265);
-            frameText.Height = Application.GetMinRealAverage(120);
+            var frameText = new FrameLayoutStatuControl();
+            frameText.Y = this.GetPictrueRealSize(265);
+            frameText.Height = this.GetPictrueRealSize(120);
             frameIcon.AddChidren(frameText);
 
             //纭畾
-            var btnOk = new NormalViewControl(frameIcon.Width, Application.GetMinRealAverage(60), false);
+            var btnOk = new NormalViewControl(frameIcon.Width, this.GetPictrueRealSize(60), false);
             btnOk.TextID = R.MyInternationalizationString.uConfirm1;
             btnOk.TextAlignment = TextAlignment.Center;
             btnOk.TextColor = UserCenterColor.Current.TextOrangeColor;
-            frameText.AddChidren(btnOk, ChidrenBindMode.BindEventOnly);
+            frameText.AddChidren(btnOk, ChidrenBindMode.BindEvent);
             //搴曠嚎
-            var btnLine1 = new NormalViewControl(Application.GetMinRealAverage(100), ControlCommonResourse.BottomLineHeight, false);
+            var btnLine1 = new NormalViewControl(this.GetPictrueRealSize(100), ControlCommonResourse.BottomLineHeight, false);
             btnLine1.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
             btnLine1.Gravity = Gravity.CenterHorizontal;
-            btnLine1.Y = btnOk.Bottom - Application.GetMinRealAverage(8);
+            btnLine1.Y = btnOk.Bottom - this.GetPictrueRealSize(8);
             frameText.AddChidren(btnLine1);
 
             //涓婇檺浣�
-            var btnDown = new NormalViewControl(frameIcon.Width, Application.GetMinRealAverage(60), false);
+            var btnDown = new NormalViewControl(frameIcon.Width, this.GetPictrueRealSize(60), false);
             btnDown.TextID = R.MyInternationalizationString.uUpLimit;
             btnDown.Y = btnOk.Bottom;
             btnDown.TextAlignment = TextAlignment.Center;
             btnDown.TextColor = UserCenterColor.Current.TextOrangeColor;
-            frameText.AddChidren(btnDown, ChidrenBindMode.BindEventOnly);
+            frameText.AddChidren(btnDown, ChidrenBindMode.BindEvent);
 
             //搴曠嚎
-            var btnLine2 = new NormalViewControl(Application.GetMinRealAverage(124), ControlCommonResourse.BottomLineHeight, false);
+            var btnLine2 = new NormalViewControl(this.GetPictrueRealSize(124), ControlCommonResourse.BottomLineHeight, false);
             btnLine2.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
             btnLine2.Gravity = Gravity.CenterHorizontal;
-            btnLine2.Y = btnDown.Bottom - Application.GetMinRealAverage(8);
+            btnLine2.Y = btnDown.Bottom - this.GetPictrueRealSize(8);
             frameText.AddChidren(btnLine2);
 
             //鍥炬爣鐐瑰嚮
@@ -350,6 +360,11 @@
             {
                 curtainDevice.CurtainUpDownStopControl(0);
             };
+            //灞曠ず妯℃澘鎴栬�呰櫄鎷熶綇瀹�,鍒欐棤鏁�
+            if (Config.Instance.Home.IsShowTemplate == true || Config.Instance.Home.IsVirtually == true)
+            {
+                frameIconback.CanClick = false;
+            }
             //閲嶅啓鎺т欢鐐瑰嚮鏁堟灉
             frameIconback.SelectStatuEvent += (select) =>
             {
@@ -374,6 +389,11 @@
                     await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.UpLimit, -1, -1);
                 });
             };
+            //灞曠ず妯℃澘鎴栬�呰櫄鎷熶綇瀹�,鍒欐棤鏁�
+            if (Config.Instance.Home.IsShowTemplate == true || Config.Instance.Home.IsVirtually == true)
+            {
+                frameText.CanClick = false;
+            }
             //閲嶅啓鎺т欢鐐瑰嚮鏁堟灉
             frameText.SelectStatuEvent += (select) =>
             {
@@ -429,6 +449,11 @@
                     });
                 });
             };
+            //灞曠ず妯℃澘鎴栬�呰櫄鎷熶綇瀹�,鍒欐棤鏁�
+            if (Config.Instance.Home.IsShowTemplate == true || Config.Instance.Home.IsVirtually == true)
+            {
+                rowReset.CanClick = false;
+            }
         }
 
         #endregion
@@ -441,14 +466,21 @@
         /// <returns></returns>
         private bool InitCurtainDefultData()
         {
+            this.curtainData = new CurtainData();
+            //濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
+            if (Common.Config.Instance.Home.IsVirtually == true)
+            {
+                var data = TemplateData.TemplateDeviceDataLogic.Current.GetCurtainLimitPoint(curtainDevice);
+                curtainData.Direction = data.Direction;
+                return true;
+            }
+
             //寮�鍚繘搴︽潯
             this.ShowProgressBar();
 
-            this.curtainData = new CurtainData();
-
             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)
@@ -497,7 +529,7 @@
                 return false;
             }
             //绉婚櫎鐩戝惉
-            HdlDeviceAttributeLogic.Current.RemoveEvent("CurtainDeviceAttribute");
+            HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute");
 
             return true;
         }
@@ -509,11 +541,11 @@
         /// <summary>
         /// 鐣岄潰鍏抽棴
         /// </summary>
-        public override void CloseForm()
+        public override void CloseFormBefore()
         {
-            HdlDeviceAttributeLogic.Current.RemoveEvent("CurtainDeviceAttribute");
+            HdlGatewayReceiveLogic.Current.RemoveEvent("CurtainDeviceAttribute");
 
-            base.CloseForm();
+            base.CloseFormBefore();
         }
 
         #endregion

--
Gitblit v1.8.0