From e44926acb6ab99ea0d5baf758773a0f383e441a9 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期五, 25 十一月 2022 14:23:54 +0800
Subject: [PATCH] 2022年11月25日14:23:44

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs                |    3 
 HDL-ON_iOS/Resources/Language.ini                                 |    5 +
 HDL-ON_Android/Assets/Language.ini                                |    6 ++
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs            |   49 ++++++++++++++--
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs    |   18 +++++-
 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs |   55 ++++++++++++++----
 HDL_ON/Common/R.cs                                                |    9 ++
 7 files changed, 122 insertions(+), 23 deletions(-)

diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini
index eb4c98f..88932f8 100644
--- a/HDL-ON_Android/Assets/Language.ini
+++ b/HDL-ON_Android/Assets/Language.ini
@@ -1115,6 +1115,9 @@
 7162=Face to open the door
 7163=Video call
 7164=Manipulator
+7165=Area intrusion alarm
+7166=camera 
+
 
 
 
@@ -2332,6 +2335,9 @@
 7162=浜鸿劯寮�闂�
 7163=瑙嗛閫氳瘽鍛煎彨
 7164=鏈烘鎵�
+7165=鍖哄煙鍏ヤ镜鍛婅
+7166=鎽勫儚澶�
+
 
 
  
diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini
index eb4c98f..787e3c2 100644
--- a/HDL-ON_iOS/Resources/Language.ini
+++ b/HDL-ON_iOS/Resources/Language.ini
@@ -1115,6 +1115,9 @@
 7162=Face to open the door
 7163=Video call
 7164=Manipulator
+7165=Area intrusion alarm
+7166=camera 
+
 
 
 
@@ -2332,6 +2335,8 @@
 7162=浜鸿劯寮�闂�
 7163=瑙嗛閫氳瘽鍛煎彨
 7164=鏈烘鎵�
+7165=鍖哄煙鍏ヤ镜鍛婅
+7166=鎽勫儚澶�
 
 
  
diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs
index ea6da3e..a3e205a 100644
--- a/HDL_ON/Common/R.cs
+++ b/HDL_ON/Common/R.cs
@@ -3038,7 +3038,14 @@
         /// 鏈烘鎵�
         /// </summary>
         public const int jixieshou = 7164;
-
+        /// <summary>
+        /// 鍖哄煙鍏ヤ镜鍛婅
+        /// </summary>
+        public const int quyuruqingaojing = 7165;
+        /// <summary>
+        /// 鎽勫儚澶�
+        /// </summary>
+        public const int shexiangtou = 7166;
 
 
         #region LE鏂板
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
index 7554d49..064ddef 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -540,8 +540,8 @@
                         fLayout.AddChidren(view1.FLayoutView());
                         view1.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
-                            identifier = "door_call_cloud_event";
-                            DeviceView(device, view1.btnState, StringId.shi, StringId.offLogic, 1);
+                            this.identifier = "door_call_cloud_event";
+                            this.DeviceView(device, view1.btnState, StringId.shi, StringId.offLogic, 1);
                         };
 
                         LogicView.FunTypeView view2 = new LogicView.FunTypeView();
@@ -550,7 +550,7 @@
                         fLayout.AddChidren(view2.FLayoutView());
                         view2.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
-                            identifier = "door_pedestrian_records";
+                            this.identifier = "door_pedestrian_records";
                             this.FaceAction(this, device, view2.btnState);
                         };
 
@@ -580,10 +580,30 @@
                         }
                         if (edit)
                         {
-                            GetEditState(device, index, view1.btnState, view2.btnState, null, null);
+                            this.GetEditState(device, index, view1.btnState, view2.btnState, null, null);
                         }
                     }
                     break;
+                //澶у崕鎽勫儚澶�
+                case SPK.IpCam_Imou:
+                    {
+                        LogicView.FunTypeView view = new LogicView.FunTypeView(); 
+                        view.btnText.TextID = StringId.quyuruqingaojing;
+                        view.btnText.Name = Language.StringByID(StringId.shipintonghuahujiao);
+                        fLayout.AddChidren(view.FLayoutView());
+                        view.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            this.identifier = "ipcam_region_alram_event";
+                            this.DeviceView(device, view.btnState, StringId.shi, StringId.offLogic, 1);
+                        };
+
+                        if (edit)
+                        {
+                            this.GetEditState(device, index, view.btnState, null, null, null);
+                        }
+                    }
+                    break;
+                    
             }
             #region  淇濆瓨
             ///淇濆瓨View
@@ -593,7 +613,7 @@
             this.AddChidren(saveView.FLayoutView());
             saveView.btnClick.MouseUpEventHandler += (sen, e) =>
             {
-                Save(device,index, edit);
+                this.SaveInput(device,index, edit);
             };
 
             #endregion
@@ -604,7 +624,7 @@
         /// </summary>
         /// <param name="index">绱㈠紩鍊�</param>
         /// <param name="edit"></param>
-        private void Save(Entity.Function device,int index, bool edit)
+        private void SaveInput(Entity.Function device,int index, bool edit) 
         {
             
             if (selectedState != "unknown")
@@ -623,8 +643,19 @@
                         inputDevice.condition = new List<Dictionary<string, string>>();
                     }
                 }
-               
-               
+                else if (device.spk == SPK.IpCam_Imou)
+                {
+                    //澶у崕鎽勫儚澶�
+                    inputDevice.condition_type = "9";
+                    inputDevice.identifier = this.identifier;
+                    if (this.identifier == "ipcam_region_alram_event")
+                    {
+                        //condition榛樿[]
+                        inputDevice.condition = new List<Dictionary<string, string>>();
+                    }
+                }
+
+
                 if (edit)
                 {
                     //绉婚櫎鏃ф暟鎹�
@@ -855,11 +886,11 @@
                     || (button.Name == Language.StringByID(StringId.diedaobaojing)))
                     {
                         //鍙湁姣背娉紶鎰熷櫒(鑷爺)
-                        Save(device, mIndex, mEdit);
+                        SaveInput(device, mIndex, mEdit);
                     }
                     else if (button.Name == Language.StringByID(StringId.shipintonghuahujiao)) {
                         //鍙湁姣背娉紶鎰熷櫒(鑷爺)
-                        Save(device, mIndex, mEdit);
+                        SaveInput(device, mIndex, mEdit);
                     }
                 }
             
@@ -921,7 +952,7 @@
                 }
                 selectedState = device.spk + "_" + value;
                 AddDictionary(keyValue, value, data_type, comparator);
-                Save(device,index, edit);
+                SaveInput(device,index, edit);
             });
         }
         /// PM2.5,Co2,Tvoc璁剧疆鍊�
@@ -979,7 +1010,7 @@
                            break;
                    }
                    AddDictionary(key, values, "integer", "in");
-                   Save(device, index, edit);
+                   SaveInput(device, index, edit);
                });
         }
         /// <summary>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
index 00c2315..e826f65 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
@@ -275,9 +275,10 @@
                         funView.btnLine.X = Application.GetRealWidth(16);
                         funView.btnLine.Width = Application.GetRealWidth(343);
                         verticalScrolView.AddChidren(funView.FLayoutView());
-                        funView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetIconPath(dev.spk);
+                        funView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetDeviceIconPath(dev);
                         funView.btnDeviceName.Text = dev.name;
                         funView.btnRoomName.Text = dev.GetRoomListName();
+
                         funView.btnClick.MouseUpEventHandler += (sen, e) =>
                         {
                             if (if_Type == LogicMethod.condition_if)
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index 2a295ff..fdb5883 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -140,7 +140,7 @@
                             //鐢╯id鎵惧埌璁惧锛�
                             var device = LogicMethod.Current.GetDevice(inputCondition.sid);
                             //鐢ㄨ澶囩殑functionType绫诲瀷鎵惧埌瀵瑰簲鍥炬爣锛�
-                            inputView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetIconPath(device.spk);
+                            inputView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetDeviceIconPath(device);
                             //鏄剧ず璁惧鍚嶇О
                             inputView.btnText.Text = device.name;
                             //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
@@ -417,6 +417,15 @@
                                             var FaceItem = this.GetFaceItem(userId, device.deviceId);
                                             inputView.btnState.Text = FaceItem.userName;
                                         }
+                                    }
+                                    break;
+                                case SPK.IpCam_Imou:
+                                    {
+                                        if (inputCondition.identifier == "door_caipcam_region_alram_eventll_cloud_event")
+                                        {
+                                            inputView.btnState.Text = Language.StringByID(StringId.quyuruqingaojing);
+                                        }
+                                        
                                     }
                                     break;
                             }
@@ -914,7 +923,7 @@
                             //鐢╯id鎵惧埌璁惧锛�
                             var device = LogicMethod.Current.GetDevice(outputTarget.sid);
                             //鐢ㄨ澶囩殑functionType绫诲瀷鎵惧埌瀵瑰簲鍥炬爣锛�
-                            targetView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetIconPath(device.spk);
+                            targetView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetDeviceIconPath(device);
                             //鏄剧ず璁惧鍚嶇О
                             targetView.btnText.Text = device.name;
                             //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
@@ -2106,6 +2115,7 @@
                         button2.Text = this.GetFaceItem(value, device.deviceId).userName;
                     }
                     break;
+              
             }
         }
         /// <summary>
@@ -2399,7 +2409,9 @@
         /// <returns></returns>
         private string GetTimeText(string strTimeValue)
         {
-            var timeValue = int.Parse(strTimeValue);
+            //鍥犱负璋冭瘯杞欢涓婁紶涓虹┖杩�;
+            string intTimeValue = string.IsNullOrEmpty(strTimeValue) ? "0" : strTimeValue;
+            var timeValue = int.Parse(intTimeValue);
             string state = "";
             var minutes = timeValue / 60;
             var seconds = timeValue % 60;
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index 4c0e435..796dd22 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -343,17 +343,39 @@
 
             return roomName.TrimEnd(',');
         }
-        #region   鍔ㄤ竴鏀瑰洓
+
         /// <summary>
         /// 鑾峰彇璁惧绫诲瀷鍥炬爣
         /// </summary>
+        /// <param name="device">璁惧</param>
+        /// <returns></returns>
+        public string GetDeviceIconPath(Function device)  
+        {
+
+            if (SPK.MusicStandard == device.spk
+                || SPK.AvMusic == device.spk)
+            {
+                return "MusicIcon/localMusic.png";
+            }
+            //LogicIcon/heatlogic.png"
+            return $"FunctionIcon/Icon/{device.IconName}.png";
+
+        }
+        /// <summary>
+        /// 鑾峰彇璁惧绫诲瀷鍥炬爣(宸插純鐢� 2022骞�11鏈�25鏃�14:07:30)
+        /// </summary>
         /// <param name="functionType">璁惧绫诲瀷</param>
         /// <returns></returns>
-        public string GetIconPath(string functionType)
+        public string GetIconPath(string spk)
         {
             string strPath = "";
-            switch (functionType)
+            switch (spk)
             {
+                case SPK.IpCam_Imou:
+                    {
+                        strPath = $"FunctionIcon/Icon/{SPK.IpCam_Imou.Replace(".", "")}.png";
+                    }
+                    break;
                 case SPK.MechanicalArm:
                     {
                         strPath = "LogicIcon/lightloguc.png";
@@ -451,10 +473,10 @@
                         strPath = "MusicIcon/localMusic.png";
                     }
                     break;
-
             }
             return strPath;
         }
+        #region   鍔ㄤ竴鏀逛笁
         /// <summary>
         /// 璁惧绫诲瀷鐨勫垪琛�(鐏厜绫伙紝绐楀笜绫汇�傘�傘��)
         /// </summary>
@@ -570,6 +592,13 @@
             {
                 deviceStrTypeList.Add(Language.StringByID(StringId.jixieshou));
             }
+            ///鎽勫儚澶寸被
+            var camera = deviceList.Find((device) =>
+            device.spk == SPK.IpCam_Imou);
+            if (camera != null)
+            {
+                deviceStrTypeList.Add(Language.StringByID(StringId.shexiangtou));
+            }
             return deviceStrTypeList;
 
         }
@@ -669,10 +698,16 @@
             else if (deviceType == Language.StringByID(StringId.VideoIntercom))
             {
                 functionTypeList.Add(SPK.doorgate);
-            }  ///鏈烘鎵嬬被
+            }
+            ///鏈烘鎵嬬被
             else  if (deviceType == Language.StringByID(StringId.jixieshou))
             {
                 functionTypeList.Add(SPK.MechanicalArm);
+            }
+            ///鎽勫儚澶寸被
+            else if (deviceType == Language.StringByID(StringId.shexiangtou))
+            {
+                functionTypeList.Add(SPK.IpCam_Imou);
             }
             else
             {
@@ -727,6 +762,7 @@
                 functionTypeList.Add(SPK.AvMusic);
                 functionTypeList.Add(SPK.doorgate);
                 functionTypeList.Add(SPK.MechanicalArm);
+                functionTypeList.Add(SPK.IpCam_Imou);
 
             }
 
@@ -784,6 +820,7 @@
                         deviceTypeList.Add(SPK.SensorHelp);
                         deviceTypeList.Add(SPK.DoorLock);
                         deviceTypeList.Add(SPK.doorgate);
+                        deviceTypeList.Add(SPK.IpCam_Imou);
 
                     }
                     break;
@@ -851,7 +888,7 @@
             return list;
         }
         /// <summary>
-        /// 缃戝叧ID(鑾峰彇鍢変箰缃戝叧ID)
+        /// 缃戝叧ID(鑾峰彇缃戝叧ID)
         /// </summary>
         public string GatewayId
         {

--
Gitblit v1.8.0