From a9d1161b1df96e7ddad566335989a1444e433ef5 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 28 三月 2023 11:54:45 +0800
Subject: [PATCH] 2023年03月28日11:52:02

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs |  112 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 103 insertions(+), 9 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
index 7398574..0dc90c0 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -261,9 +261,10 @@
         /// </summary>
         /// <param name="frame">鏄剧ず鍦ㄥ摢涓晫闈㈢殑鐖舵帶浠�</param>
         /// <param name="list">鏄剧ず鏁版嵁婧�</param>
+        /// <param name="stateList">涔嬪墠鐘舵�佹暟鎹簮</param>
         /// <param name="titleText">鏍囬</param>
         /// <param name="action">杩斿洖鍊肩储寮曞��</param>
-        public void FrameOrVv(FrameLayout frame, List<string> list, List<string> stateList, int titleText, Action<int> action)
+        public void FrameOrVv(FrameLayout frame, List<string> list, List<string> stateList, string titleText, Action<int> action,bool isIcon=true)
         {
 
             int line = 0;
@@ -284,7 +285,7 @@
             frame.AddChidren(frameLayout);
 
             LogicView.DateView view = new LogicView.DateView();
-            view.btnTitle.TextID = titleText;
+            view.btnTitle.Text = titleText;
             view.FLayoutView(frameLayout, line);
             view.btnCancel.MouseUpEventHandler += (sender, e) =>
             {
@@ -310,7 +311,7 @@
                 verticalRefresh.EndHeaderRefreshing();
             };
 
-            if (list.Count == 0)
+            if (list.Count == 0&&isIcon)
             {
                 Button btnTipNot = new Button
                 {
@@ -367,12 +368,18 @@
                     verticalRefresh.AddChidren(checkView.FLayoutView());
                 }
 
-                if (stateList.Contains(strName))
-                {
-                    checkView.btnCheckIcon.IsSelected = true;
-                }
                 checkView.btnText.Text = strName;
                 checkView.btnClick.Tag = i;//鏍囪
+
+                if (stateList.Contains(strName))
+                {
+                    //checkView.btnCheckIcon.IsSelected = true;
+
+                    checkBtn.IsSelected = false;
+                    checkView.btnCheckIcon.IsSelected = true;
+                    checkBtn = checkView.btnCheckIcon;
+                    checkBtn.Tag = checkView.btnClick.Tag.ToString();
+                }
                 //鐐瑰嚮浜嬩欢
                 checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
                 {
@@ -682,7 +689,7 @@
                 case "time":
                     {
                         list = new List<string> {
-                   "30 s",
+                   //"30 s",
                    "1 min",
                    "2 min",
                    "3 min",
@@ -747,6 +754,93 @@
             }
             return list;
         }
+        /// <summary>
+        /// 鍔ㄦ�佽幏鍙栦紶鎰熷櫒绛夌骇鍒楄〃
+        /// </summary>
+        /// <param name="device">鍔熻兘(sid)</param>
+        /// <returns></returns>
+        public List<string> GetSensorLevelList(Entity.Function device)
+        {
+            List<string> list = new List<string>();
+            var dic = GetSensorLevelDic(device);
+            foreach (var d in dic) {
+                list.Add(d.Key);
+            }
+            return list;
+        }
+        /// <summary>
+        /// 鎸囧畾鑾峰彇绛夌骇鎷兼帴鐨勫瓧绗︿覆
+        /// </summary>
+        /// <param name="device">鍔熻兘(sid)</param>
+        /// <param name="s">鍒濆鍊�</param>
+        /// <param name="isTextBoolean">琛ㄧずtrue(杩斿洖key);false(杩斿洖values)</param>
+        /// <returns></returns>isTextBoolean
+        public string GetSensorLevelText(Entity.Function device, string s, bool isTextBoolean)
+        {
+            if (device == null || device.attrKeyConfigs == null)
+            {
+                return "";
+            }
+            var dic = GetSensorLevelDic(device);
+            if (isTextBoolean)
+            {
+                foreach (var d in dic)
+                {
+                    if (d.Value==s)
+                    {
+                        //濡傛灉values鍊煎瓨鍦紝杩斿洖key鍊�
+                        return d.Key.ToString();
+                    }
+                }
+                
+            }
+            else
+            {
+                foreach (var d in dic)
+                {
+                    if (d.Key==s)
+                    {
+                        //濡傛灉key鍊煎瓨鍦紝杩斿洖values鍊�
+                        return d.Value.ToString();
+                    }
+                }
+            }
+            return "";
+        }
+        /// <summary>
+        /// 鍔ㄦ�佽幏鍙栦紶鎰熷櫒绛夌骇瀛楀吀
+        /// </summary>
+        /// <param name="device">鍔熻兘(sid)</param>
+        /// <returns></returns>
+        public Dictionary<string,string> GetSensorLevelDic(Entity.Function device)
+        {
+            Dictionary<string, string> dic = new Dictionary<string, string>();
+            if (device == null || device.attrKeyConfigs == null)
+            {
+                return dic;
+            }
+            string strKey = "";
+            string strKeyValues = "";   
+            for (int i = 0; i < device.attrKeyConfigs.Count; i++)
+            {
+                var attrKeyConfig = device.attrKeyConfigs[i];
+                foreach (var attrKeyInfo in attrKeyConfig.configs)
+                {
+                    //鍔ㄦ�佹嫾鎺ュ瓧绗︿覆
+                    strKey = attrKeyInfo.desc + ":" + attrKeyInfo.start + "~" + attrKeyInfo.end + attrKeyConfig.unit;
+                    strKeyValues = "(" + attrKeyInfo.start + "," + attrKeyInfo.end + "]";
+                    if (!dic.ContainsKey(strKey))
+                    {
+                        //娌℃湁鍐嶆坊鍔�
+                        dic.Add(strKey, strKeyValues);
+                    }
+                   
+                }
+
+            }
+            return dic;
+        }
+
         /// <summary>
         /// 妯″紡/椋庨�熶簰鐩歌浆鎹㈠�肩殑鏂规硶
         /// </summary>
@@ -966,7 +1060,7 @@
                             case "(115,150]": {
                                     text = Language.StringByID(StringId.pmzhongdu);
                                 } break;
-                            case "(151,100000]": {
+                            case "(150,100000]": {
                                     text = Language.StringByID(StringId.pmzhongduwuran);
                                 } break;
                         }

--
Gitblit v1.8.0