From 282f291d9279319b0e6b4a882b02ed2b50501c04 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期三, 18 十月 2023 15:28:16 +0800
Subject: [PATCH] 2023年10月18日15:27:09

---
 HDL_ON/UI/UI2/FuntionControlView/Aks/YkqPage.cs                         |   12 +--
 HDL_ON/UI/UI2/FuntionControlView/Aks/GfPage.cs                          |   13 +--
 HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/BaseFramLayout.cs       |    6 +-
 HDL_ON/UI/UI2/FuntionControlView/Aks/TvPage.cs                          |    5 +
 HDL_ON/DAL/Server/HttpUtil.cs                                           |    4 
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs          |    6 +-
 HDL_ON/UI/UI2/FuntionControlView/Aks/MusicPage.cs                       |    8 +-
 HDL_ON/UI/UI2/FuntionControlView/Aks/TyyPage.cs                         |    6 ++
 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs       |    8 ++
 HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ButtonFramLayout.cs     |    3 
 HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeSingleFramLayout.cs |   63 ++++++++++++++++++++-
 HDL_ON/UI/UI2/FuntionControlView/Aks/JdhPage.cs                         |    5 +
 12 files changed, 108 insertions(+), 31 deletions(-)

diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs
index 5235064..b659327 100644
--- a/HDL_ON/DAL/Server/HttpUtil.cs
+++ b/HDL_ON/DAL/Server/HttpUtil.cs
@@ -18,8 +18,8 @@
         /// 鍥哄畾鍩熷悕,姝e紡鐜
         /// 鍏叡鍩熷悕灏辫繎瑙f瀽
         /// </summary>
-        public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
-        //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
+        //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
+        public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
         const string APP_KEY = "HDL-HOME-APP-TEST";
         const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
 
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
index 345ebdd..3b9cf3e 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -998,11 +998,19 @@
                     case StringId.onLogic:
                         {
                             value = "on";
+                            if (device.spk== SPK.SensorDryContact) {
+                                value = "open";
+                            }
+
                         }
                         break;
                     case StringId.offLogic:
                         {
                             value = "off";
+                            if (device.spk == SPK.SensorDryContact)
+                            {
+                                value = "close";
+                            }
                         }
                         break;
                     case StringId.youren:
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index ff12c6b..80db2e3 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -218,9 +218,9 @@
                                 case SPK.SensorDryContact2:
                                     {
 
-                                        string value = this.GetKeyValue("on_off", dicList);
+                                        string value = this.GetKeyValue("contact_status", dicList);
                                         inputView.btnState.Text = Language.StringByID(StringId.offLogic);
-                                        if (value == "on")
+                                        if (value == "open")
                                         {
                                             inputView.btnState.Text = Language.StringByID(StringId.onLogic);
                                         }
@@ -2292,7 +2292,7 @@
                         foreach (var dic in dicList)
                         {
                             string value = dic["value"];
-                            if (value == "on")
+                            if (value == "open")
                             {
                                 button1.Text = Language.StringByID(StringId.onLogic);
                             }
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/BaseFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/BaseFramLayout.cs
index cfd3d02..72a5ba3 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/BaseFramLayout.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/BaseFramLayout.cs
@@ -2,7 +2,7 @@
 using Shared;
 namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView
 {
-    public class BaseFramLayout:FrameLayout
+    public class BaseFramLayout : FrameLayout
     {
         public BaseFramLayout()
         {
@@ -61,9 +61,9 @@
             return bottomHeight;
         }
 
-
+       
 
     }
 
- 
+
 }
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ButtonFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ButtonFramLayout.cs
index ee23c59..7fb3e4a 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ButtonFramLayout.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ButtonFramLayout.cs
@@ -152,9 +152,8 @@
         {
             EventHandler<MouseEventArgs> UpClick = (sender, e) =>
             {
-               
-                this.BackgroundColor = 0x00000000;
                 action?.Invoke(this, btnImage, btnName);
+                this.BackgroundColor = 0x00000000;
 
                 //寮硅捣鏉ヨ繕鍘熻儗鏅鑹�
             };
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeSingleFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeSingleFramLayout.cs
index 15f7d9f..aa7ac69 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeSingleFramLayout.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeSingleFramLayout.cs
@@ -53,8 +53,7 @@
             TextColor = MusicColor.TextColor,
             TextAlignment = TextAlignment.Center,
             Gravity = Gravity.CenterVertical,
-            IsMoreLines = true,
-            Padding=new Padding(0,0,0,0),
+            Padding = new Padding(0, 0, 0, 0),
             Name = "btnName",
         };
 
@@ -114,12 +113,70 @@
             {
                 //鎸変笅鍘绘敼鍙樿儗鏅鑹�
                 //singleFramLayout.BackgroundColor = this.DownBackgroundColor;
-                
+
             };
             singleFramLayout.MouseDownEventHandler += DownClick;
             btnLeftImage.MouseDownEventHandler += DownClick;
             btnName.MouseDownEventHandler += DownClick;
             btnRightImage.MouseDownEventHandler += DownClick;
         }
+
+
+        /// <summary>
+        /// 鑷姩璁$畻鎺т欢闀垮害
+        /// </summary>
+        /// <param name="orientation">浣嶇疆(宸︽垨鍙�)</param>
+        /// <param name="frame">鐖跺鍣�</param>
+        /// <param name="btnName">澶囨敞鎺т欢</param>
+        /// <param name="btnImage">鍥炬爣澶囨敞鎺т欢</param>
+        /// <param name="btnNameWidth">澶囨敞鎺т欢瀹藉害</param>
+        /// <param name="btnNameWidthMaxValue">澶囨敞鎺т欢瀹藉害鏈�澶у��</param> 
+        /// <param name="parentDefaultWidthMaxValue">鐖舵帶浠跺搴﹂粯璁ゆ渶澶у��</param>
+        public void CustomCalculationWidth(Orientation orientation, FrameLayout frame, Button btnName, Button btnImage, int btnNameWidth,int btnNameWidthMaxValue = 110, int parentDefaultWidthMaxValue = 101)
+        {
+
+            int parentRightX = 226;
+            int parentLeftX = 16;
+
+
+            if (btnName.GetTextWidth() > Application.GetRealWidth(btnNameWidth))
+            {
+                frame.Width = Application.GetRealWidth(parentDefaultWidthMaxValue - btnNameWidth) + btnName.GetTextWidth();
+                if (orientation == Orientation.right)
+                {
+                    frame.X = Application.GetRealWidth(parentRightX + btnNameWidth) - btnName.GetTextWidth();
+                }
+                else if (orientation == Orientation.left)
+                {
+                    frame.X = Application.GetRealWidth(parentLeftX);
+                }
+                btnName.Width = btnName.GetTextWidth();
+                btnImage.X = btnName.Right + Application.GetRealWidth(8);
+            }
+
+            if (btnName.GetTextWidth() > Application.GetRealWidth(btnNameWidthMaxValue))
+            {
+
+                btnName.Width = Application.GetRealWidth(btnNameWidthMaxValue);
+                if (orientation == Orientation.right)
+                {
+                    frame.X =Application.GetRealWidth(parentRightX+ btnNameWidth) - btnName.Width;
+                }
+                else if (orientation == Orientation.left)
+                {
+                    frame.X = Application.GetRealWidth(parentLeftX);
+                }
+                frame.Width = Application.GetRealWidth(parentDefaultWidthMaxValue - btnNameWidth) + btnName.Width;
+                btnImage.X = btnName.Right + Application.GetRealWidth(8);
+            }
+
+        }
+
+        public enum Orientation
+        {
+            left,
+            right,
+
+        }
     }
 }
\ No newline at end of file
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/GfPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/GfPage.cs
index 3640e3f..11e01c8 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Aks/GfPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/GfPage.cs
@@ -140,14 +140,11 @@
                 gfSingleFramLayout.btnRightImage.UnSelectedImagePath = "AksIcon/xuanze.png";
                 gfSingleFramLayout.btnRightImage.Gravity = Gravity.CenterVertical;
                 gfSingleFramLayout.btnLeftImage.Visible = false;
-
-                if (gfSingleFramLayout.btnName.GetTextWidth() > Application.GetRealWidth(48))
-                {
-                    gfSingleFramLayout.singleFramLayout.Width = Application.GetRealWidth(101 - 48) + gfSingleFramLayout.btnName.GetTextWidth();
-                    gfSingleFramLayout.singleFramLayout.X = Application.GetRealWidth(226 + 48) - gfSingleFramLayout.btnName.GetTextWidth();
-                    gfSingleFramLayout.btnName.Width = gfSingleFramLayout.btnName.GetTextWidth();
-                    gfSingleFramLayout.btnRightImage.X = gfSingleFramLayout.btnName.Right + Application.GetRealWidth(8);
-                }
+                gfSingleFramLayout.CustomCalculationWidth(TypeSingleFramLayout.Orientation.right,
+                gfSingleFramLayout.singleFramLayout,
+                gfSingleFramLayout.btnName,
+                gfSingleFramLayout.btnRightImage,
+                48, 200);
             }
             else
             {
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/JdhPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/JdhPage.cs
index 01a57c2..a635f30 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Aks/JdhPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/JdhPage.cs
@@ -301,6 +301,11 @@
                 jdhSingleFramLayout.btnRightImage.UnSelectedImagePath = "AksIcon/xuanze.png";
                 jdhSingleFramLayout.btnRightImage.Gravity = Gravity.CenterVertical;
                 jdhSingleFramLayout.btnLeftImage.Visible = false;
+                jdhSingleFramLayout.CustomCalculationWidth(TypeSingleFramLayout.Orientation.right,
+                jdhSingleFramLayout.singleFramLayout,
+                jdhSingleFramLayout.btnName,
+                 jdhSingleFramLayout.btnRightImage,
+                 48, 200);
             }
             else
             {
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/MusicPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/MusicPage.cs
index c0f0d20..977282f 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Aks/MusicPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/MusicPage.cs
@@ -181,9 +181,11 @@
                 bfqSingleFramLayout.btnRightImage.UnSelectedImagePath = "AksIcon/xuanze.png";
                 bfqSingleFramLayout.btnRightImage.Gravity = Gravity.CenterVertical;
                 bfqSingleFramLayout.btnLeftImage.Visible = false;
-
-
-
+                bfqSingleFramLayout.CustomCalculationWidth(TypeSingleFramLayout.Orientation.left,
+                    bfqSingleFramLayout.singleFramLayout,
+                    bfqSingleFramLayout.btnName,
+                     bfqSingleFramLayout.btnRightImage,
+                     48);
 
                 //褰卞簱
                 ykSingleFramLayout = new TypeSingleFramLayout();
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/TvPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/TvPage.cs
index 188a1fc..0cd10f0 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Aks/TvPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/TvPage.cs
@@ -307,6 +307,11 @@
                 tvSingleFramLayout.btnRightImage.UnSelectedImagePath = "AksIcon/xuanze.png";
                 tvSingleFramLayout.btnRightImage.Gravity = Gravity.CenterVertical;
                 tvSingleFramLayout.btnLeftImage.Visible = false;
+                tvSingleFramLayout.CustomCalculationWidth(TypeSingleFramLayout.Orientation.right,
+                  tvSingleFramLayout.singleFramLayout,
+                  tvSingleFramLayout.btnName,
+                   tvSingleFramLayout.btnRightImage,
+                   48, 200);
             }
             else
             {
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/TyyPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/TyyPage.cs
index a3e6dfb..1f1afab 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Aks/TyyPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/TyyPage.cs
@@ -177,6 +177,12 @@
                 tyySingleFramLayout.btnRightImage.UnSelectedImagePath = "AksIcon/xuanze.png";
                 tyySingleFramLayout.btnRightImage.Gravity = Gravity.CenterVertical;
                 tyySingleFramLayout.btnLeftImage.Visible = false;
+               tyySingleFramLayout.CustomCalculationWidth(TypeSingleFramLayout.Orientation.right,
+                    tyySingleFramLayout.singleFramLayout,
+                    tyySingleFramLayout.btnName,
+                     tyySingleFramLayout.btnRightImage,
+                     48,200);
+
             }
             else
             {
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/YkqPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/YkqPage.cs
index 5dcca72..527741b 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Aks/YkqPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/YkqPage.cs
@@ -1174,13 +1174,11 @@
                 tyySingleFramLayout.btnRightImage.Gravity = Gravity.CenterVertical;
                 tyySingleFramLayout.btnLeftImage.Visible = false;
 
-                if (tyySingleFramLayout.btnName.GetTextWidth() > Application.GetRealWidth(48))
-                {
-                    tyySingleFramLayout.singleFramLayout.Width = Application.GetRealWidth(101 - 48) + tyySingleFramLayout.btnName.GetTextWidth();
-                    tyySingleFramLayout.singleFramLayout.X = Application.GetRealWidth(226 + 48) - tyySingleFramLayout.btnName.GetTextWidth();
-                    tyySingleFramLayout.btnName.Width = tyySingleFramLayout.btnName.GetTextWidth();
-                    tyySingleFramLayout.btnRightImage.X = tyySingleFramLayout.btnName.Right + Application.GetRealWidth(8);
-                }
+                tyySingleFramLayout.CustomCalculationWidth(TypeSingleFramLayout.Orientation.right,
+                  tyySingleFramLayout.singleFramLayout,
+                  tyySingleFramLayout.btnName,
+                   tyySingleFramLayout.btnRightImage,
+                   48, 200);
 
             }
             else

--
Gitblit v1.8.0