From e22e6699a4ec73e81f45526eb8249379963e22d7 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 14 九月 2022 13:49:05 +0800
Subject: [PATCH] 光伏更新

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs |  135 ++++++++++++++++++++++++++++++++++++++------
 1 files changed, 115 insertions(+), 20 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
index 7f0cc74..3c52457 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -24,10 +24,20 @@
         /// 瀹氫箟涓�涓彉閲忥紝璁板綍閫変腑鐘舵��
         /// </summary>
         private string selectedState = "unknown";
+        /// <summary>
+        /// 鏄笉鏄啀娆$紪杈�
+        /// </summary>
+        private bool mEdit;
+        /// <summary>
+        /// 杈撳叆鏉′欢鍒楄〃绱㈠紩鍊�
+        /// </summary>
+        private int mIndex;
 
         public void Show(Entity.Function device, int index, bool edit)
         {
             this.function = device;
+            this.mEdit = edit;
+            this.mIndex = index;
             #region 鐣岄潰甯冨眬
             this.BackgroundColor = CSS.CSS_Color.viewMiddle;
             LogicView.TopView topView = new LogicView.TopView();
@@ -61,7 +71,6 @@
                 //绌鸿皟
                 case SPK.AcStandard:
                 case SPK.HvacAC:
-                case SPK.HvacCac://姣涚粏绌鸿皟
                 //鍦扮儹
                 case SPK.FloorHeatStandard:
                 case SPK.HvacFloorHeat:
@@ -79,22 +88,6 @@
                         view.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
                             DeviceView(device, view.btnState, StringId.onLogic, StringId.offLogic);
-                        };
-                        if (edit)
-                        {
-                            GetEditState(device, index, view.btnState, null, null, null);
-                        }
-                    }
-                    break;
-                //绱ф�ュ懠鍙�
-                case SPK.SensorHelp:
-                    {
-                        LogicView.FunTypeView view = new LogicView.FunTypeView();
-                        view.btnText.TextID = StringId.qiujiuandzhengchang;
-                        fLayout.AddChidren(view.FLayoutView());
-                        view.btnClick.MouseUpEventHandler += (sender, e) =>
-                        {
-                            DeviceView(device, view.btnState, StringId.qiujiu, StringId.zhengchang);
                         };
                         if (edit)
                         {
@@ -217,8 +210,64 @@
                         }
                     }
                     break;
-                //姣背娉紶鎰熷櫒
+                //姣背娉紶鎰熷櫒(鑷爺鍖楅偖)
                 case SPK.SenesorMegahealth:
+                    {
+                        int intValue =0;
+                        if (edit)
+                        {
+                            Input inputs = Logic.currlogic.input[index];
+                            var dicList = inputs.condition;
+                            foreach (var dic in dicList)
+                            {
+                                if (dic["key"] == "target_status")
+                                {
+                                    intValue = 1;
+                                }
+                                else
+                                {
+                                    intValue = 2;
+                                }
+                                break;
+
+                            }
+                        }
+                        LogicView.FunTypeView view1= new LogicView.FunTypeView(); 
+                        view1.btnText.TextID = StringId.diedaobaojing;
+                        view1.btnState.Name = Language.StringByID(StringId.diedaobaojing);
+                        fLayout.AddChidren(view1.FLayoutView());
+                        view1.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            DeviceView(device, view1.btnState, StringId.shi, StringId.offLogic, 1);
+                        };
+                        
+                        LogicView.FunTypeView view2 = new LogicView.FunTypeView();
+                        view2.frameLayout.Y = view1.frameLayout.Bottom;
+                        view2.btnText.TextID = StringId.yourenbaojing;
+                        view2.btnState.Name = Language.StringByID(StringId.yourenbaojing);
+                        fLayout.AddChidren(view2.FLayoutView());
+
+                        if (intValue==1) {
+                            view2.frameLayout.Visible = false;
+                           
+                        }
+                        if (intValue == 2)
+                        {
+                            view2.frameLayout.Y = Application.GetRealHeight(0);
+                        }
+
+                        view2.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            DeviceView(device, view2.btnState, StringId.youren, StringId.wuren, 2);
+                        };
+                        if (edit)
+                        {
+                            GetEditState(device, index, view1.btnState, view2.btnState, null, null);
+                        }
+
+                    }
+                    break;
+                //姣背娉紶鎰熷櫒(鍏嗚涓撶敤浜戜簯瀵规帴)
                 case SPK.SenesorMegahealth2:
                     {
                         LogicView.FunTypeView view = new LogicView.FunTypeView();
@@ -517,7 +566,6 @@
                     case SPK.SensorGas:
                     case SPK.SensorWater:
                     case SPK.SensorSmoke:
-                    case SPK.SensorHelp:
                         {
                             keyVlaue = "status";
                             if (!Is_SpkAttribute(keyVlaue)) {
@@ -550,6 +598,23 @@
                         }
                         break;
                     case SPK.SenesorMegahealth:
+                        {
+                            if (button != null)
+                            {
+                                
+                                if (button.Name == Language.StringByID(StringId.yourenbaojing))
+                                {
+                                    keyVlaue = "people_status";
+                                   
+                                }
+                                else
+                                {
+                                    keyVlaue = "target_status";
+                                }
+                            }
+
+                        }
+                        break;
                     case SPK.SenesorMegahealth2:
                         {
                             keyVlaue = "action_state";
@@ -597,7 +662,7 @@
                         break;
                     case StringId.wuren:
                         {
-                            if (device.spk == SPK.SenesorMegahealth || device.spk == SPK.SenesorMegahealth2)
+                            if (device.spk == SPK.SenesorMegahealth2)
                             {
                                 value = "uninhabited";
                             }
@@ -608,6 +673,25 @@
                         }
                         break;
                     case StringId.shi:
+                        {
+                            value = "open";
+                            if (button != null)
+                            {
+
+                                if (button.Name == Language.StringByID(StringId.yourenbaojing))
+                                {
+                                    //鐘舵��(鏈変汉)
+                                    value = "true";
+
+                                }
+                                else if(button.Name == Language.StringByID(StringId.diedaobaojing))
+                                {
+                                    //璺屽��
+                                    value = "4";
+                                }
+                            }
+                        }
+                        break;
                     case StringId.kaiqi:
                         {
                             value = "open";
@@ -639,6 +723,17 @@
                 button.TextID = intValue;
                 selectedState = device.spk + "_" + value;
                 AddDictionary(keyVlaue, value, "string");
+                if (button != null)
+                {
+
+                    if (button.Name == Language.StringByID(StringId.yourenbaojing)
+                    || (button.Name == Language.StringByID(StringId.diedaobaojing)))
+                    {
+                        //鍙湁姣背娉紶鎰熷櫒(鑷爺)
+                        Save(device, mIndex, mEdit);
+                    }
+                }
+            
 
             });
 

--
Gitblit v1.8.0