From 46af47e8d94f78dc7b52dd013f5f8b142299886d Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期四, 30 三月 2023 12:00:00 +0800
Subject: [PATCH] 2023年03月30日11:59:41

---
 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs      |   92 ++++++++++++------
 HDL_ON/Common/HDLCommon.cs                                          |   25 +---
 HDL_ON/DAL/Server/HttpUtil.cs                                       |    4 
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs              |    6 +
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs      |    3 
 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs   |    1 
 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs |   27 +++--
 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs      |    1 
 HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs           |  135 +++++++++++++++++++++++++-
 9 files changed, 228 insertions(+), 66 deletions(-)

diff --git a/HDL_ON/Common/HDLCommon.cs b/HDL_ON/Common/HDLCommon.cs
index 1e5d28d..800c3d2 100644
--- a/HDL_ON/Common/HDLCommon.cs
+++ b/HDL_ON/Common/HDLCommon.cs
@@ -275,10 +275,10 @@
                     //鎶ヨ鎺ㄩ�佹墠寮圭獥鎻愮ず锛坢essageType鍖呭惈Alarm鍏抽敭瀛楃殑锛�
                     if (jpushMessageInfo.messageType.Contains(PushMessageType.Alarm.ToString()))
                     {
-                      //钀ょ煶闂ㄩ攣鏇存柊寮�閿佸浘鏍�
-                      HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.UpdateDoorLockState(PushMessageType.Alarm, jpushMessageInfo.HomeId, jpushMessageInfo.spk, jpushMessageInfo.Extras);
-                      //鎶ヨ鎺ㄩ�佸脊绐楁彁绀�
-                      ShowAlarmPushMessage(jpushMessageInfo, true);
+                        //鎶ヨ鎺ㄩ�佸脊绐楁彁绀�
+                        ShowAlarmPushMessage(jpushMessageInfo, true);
+                        //钀ょ煶闂ㄩ攣鎺ㄩ��
+                        HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.DoorLockPush(jpushMessageInfo);
                     }
                     else if (jpushMessageInfo.messageType.Contains(PushMessageType.FLCall.ToString()))
                     {
@@ -387,22 +387,15 @@
                     else if (jpushMessageInfo.messageType.Contains(PushMessageType.Prompt.ToString()))
                     {
                         ShowAlarmPushMessage(jpushMessageInfo, false);
+                        //钀ょ煶闂ㄩ攣鎺ㄩ��
+                        HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.DoorLockPush(jpushMessageInfo);
                     }
                     else if (jpushMessageInfo.messageType.Contains(PushMessageType.DOOR_BELL.ToString()))
                     {
-                        try
-                        {
-                            if (string.IsNullOrEmpty(jpushMessageInfo.expantContent)) return;
-                            var expantContent = Newtonsoft.Json.JsonConvert.DeserializeObject<UI.UI2.FuntionControlView.VideoDoorLock.ExpantContent>(jpushMessageInfo.expantContent);
-                            if (expantContent == null)
-                            {
-                                return;
-                            }
-                            ///瑙嗛闂ㄩ攣
-                            HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.SkipRTVActivity(expantContent.devSerial, expantContent.deviceId, expantContent.spk, true);
-                        }
-                        catch { }
+                        //钀ょ煶闂ㄩ攣鎺ㄩ��
+                        HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.DoorLockPush(jpushMessageInfo);
                     }
+
                 }
             }
             catch (Exception EX)
diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs
index bf39c96..511a91e 100644
--- a/HDL_ON/DAL/Server/HttpUtil.cs
+++ b/HDL_ON/DAL/Server/HttpUtil.cs
@@ -17,8 +17,8 @@
         /// 鍥哄畾鍩熷悕,姝e紡鐜
         /// 鍏叡鍩熷悕灏辫繎瑙f瀽
         /// </summary>
-        //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
-        public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm
+        public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
+        //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm
         /// <summary>
         /// RegionMark
         /// </summary>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
index 335597a..ef2c271 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -89,6 +89,7 @@
                 //绌鸿皟
                 case SPK.AcStandard:
                 case SPK.HvacAC:
+                case SPK.AcIr:
                 //鍦扮儹
                 case SPK.FloorHeatStandard:
                 case SPK.HvacFloorHeat:
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index c389912..7c63f6c 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -162,6 +162,7 @@
                                 //绌鸿皟
                                 case SPK.AcStandard:
                                 case SPK.HvacAC:
+                                case SPK.AcIr:
                                 //鍦扮儹
                                 case SPK.HvacFloorHeat:
                                 case SPK.FloorHeatStandard:
@@ -1087,6 +1088,7 @@
                                     break;
                                 case SPK.AcStandard:
                                 case SPK.HvacAC:
+                                case SPK.AcIr:
                                     {
                                         string on_off = GetKeyValue("on_off", dicList);
                                         string set_temp = GetKeyValue("set_temp", dicList);
@@ -1668,6 +1670,7 @@
                     break;
                 case SPK.AcStandard:
                 case SPK.HvacAC:
+                case SPK.AcIr:
                     {
                         foreach (var dic in dicList)
                         {
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index d8690c5..7b9e37d 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -519,7 +519,7 @@
                 deviceStrTypeList.Add(Language.StringByID(StringId.Curtain));
             }
             ///绌鸿皟绫�
-            var ac = deviceList.Find((device) => device.spk == SPK.AcStandard || device.spk == SPK.HvacAC);
+            var ac = deviceList.Find((device) => device.spk == SPK.AcStandard || device.spk == SPK.HvacAC|| device.spk == SPK.AcIr);
             if (ac != null)
             {
                 deviceStrTypeList.Add(Language.StringByID(StringId.AC));
@@ -647,6 +647,7 @@
                 functionTypeList.Add(SPK.AcStandard);
                 functionTypeList.Add(SPK.HvacAC);
                 functionTypeList.Add(SPK.HvacCac);
+                functionTypeList.Add(SPK.AcIr);
             }
             ///鍦版殩绫�
             else if (deviceType == Language.StringByID(StringId.FloorHeating))
@@ -777,6 +778,7 @@
                 functionTypeList.Add(SPK.IpCam_Imou);
                 functionTypeList.Add(SPK.SensorPm10);
                 functionTypeList.Add(SPK.VideoDoorLock);
+                functionTypeList.Add(SPK.AcIr);
 
             }
 
@@ -837,6 +839,7 @@
                         deviceTypeList.Add(SPK.IpCam_Imou);
                         deviceTypeList.Add(SPK.SensorPm10);
                         deviceTypeList.Add(SPK.VideoDoorLock);
+                        deviceTypeList.Add(SPK.AcIr);
 
                     }
                     break;
@@ -860,6 +863,7 @@
                         deviceTypeList.Add(SPK.MusicStandard);
                         deviceTypeList.Add(SPK.AvMusic);
                         deviceTypeList.Add(SPK.MechanicalArm);
+                        deviceTypeList.Add(SPK.AcIr);
                     }
                     break;
             }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
index 9cfe721..519be9f 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -297,6 +297,7 @@
                     break;
                 case SPK.AcStandard:
                 case SPK.HvacAC:
+                case SPK.AcIr:
                     {
                         #region 鐣岄潰
                         ///寮�鍏�
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs b/HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs
index 65e7438..8ab919c 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Video/View/ShowDialog.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using HDL_ON.UI.CSS;
 using HDL_ON.UI.Music;
 using Shared;
 namespace HDL_ON.UI.UI2.FuntionControlView.Video.View
@@ -24,7 +25,7 @@
         }
 
 
-       public  Dialog dialog;
+        public Dialog dialog;
 
         /// <summary>
         /// 
@@ -79,7 +80,7 @@
 
             };
             whiteView.AddChidren(btnTitle);
-           
+
             Button guaduanIconBtn = new Button
             {
                 X = Application.GetRealWidth(75),
@@ -111,6 +112,128 @@
 
         }
 
+        /// <summary>
+        /// 鍒濆鍖朌ialog
+        /// </summary>
+        /// <param name="titleStr">鏍囬</param>
+        /// <param name="msgStr">鎻愮ず淇℃伅</param>
+        /// <param name="okAction"></param>
+        /// <param name="cancelAction"></param>
+        /// <param name="cancelID"></param>
+        /// <param name="confirmID"></param>
+        public void ShowDialogBase(string titleStr, string msgStr, Action okAction, Action cancelAction, int cancelID = StringId.Cancel, int confirmID = StringId.Confirm, bool isAlarmColor = false)
+        {
+            if (dialog != null)
+            {
+                //闃叉浜岄噸鐣岄潰
+                dialog.Close();
+            }
+            dialog = new Dialog()
+            {
+                BackgroundColor = MusicColor.PopupBackgroundColor,
+            };
+
+            var bodyView = new FrameLayout();
+            dialog.AddChidren(bodyView);
+
+            FrameLayout contentView = new FrameLayout()
+            {
+                Gravity = Gravity.Center,
+                Width = Application.GetRealWidth(270),
+                Height = Application.GetRealHeight(140),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+                BorderColor = 0x00000000,
+                BorderWidth = 0,
+                Radius = (uint)Application.GetMinRealAverage(10),
+            };
+            bodyView.AddChidren(contentView);
+
+            Button btnTitle = new Button()
+            {
+                Y = Application.GetRealHeight(20),
+                Height = Application.GetRealHeight(22),
+                TextColor = CSS_Color.MainColor,
+                TextSize = CSS_FontSize.SubheadingFontSize,
+                TextAlignment = TextAlignment.Center,
+                IsBold = true,
+                Text = titleStr,
+            };
+            contentView.AddChidren(btnTitle);
+            int Width135 = Application.GetRealWidth(135);
+            //鎻愮ず鍐呭鎸夐挳
+            Button btnMsg = new Button()
+            {
+                Y = btnTitle.Bottom + Application.GetRealHeight(4),
+                X = Application.GetRealWidth(6),
+                Height = Application.GetRealHeight(46),
+                Width = Application.GetRealWidth(258),
+                TextAlignment = TextAlignment.Center,
+                TextColor = CSS_Color.TextualColor,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                Text = msgStr,
+                IsMoreLines = true,
+            };
+            contentView.AddChidren(btnMsg);
+
+            Button btnLine = new Button()
+            {
+                Y = Application.GetRealHeight(96),
+                Height = Application.GetRealHeight(1),
+                Width = Application.GetRealWidth(270 / 2),
+                BackgroundColor = CSS_Color.DividingLineColor,
+            };
+            contentView.AddChidren(btnLine);
+
+            Button btnCancel = new Button()
+            {
+                Y = btnLine.Bottom,
+                Width = Width135,
+                Height = Application.GetRealHeight(43),
+                TextAlignment = TextAlignment.Center,
+                TextColor = CSS_Color.TextualColor,
+                TextSize = CSS_FontSize.SubheadingFontSize,
+                TextID = cancelID,
+            };
+            contentView.AddChidren(btnCancel);
+
+            Button btnConfirm = new Button()
+            {
+                X = contentView.Width - Width135,
+                Y = btnLine.Y,
+                Width = Width135,
+                Height = Application.GetRealHeight(45),
+                TextAlignment = TextAlignment.Center,
+                //TextColor = CSS_Color.TextualColor,
+                TextSize = CSS_FontSize.SubheadingFontSize,
+                TextColor = CSS_Color.MainBackgroundColor,
+                BackgroundColor = CSS_Color.MainColor,
+                TextID = confirmID,
+            };
+            contentView.AddChidren(btnConfirm);
+            //渚嬶細鍙充笅鍦嗚 澶у皬涓�50
+            int mRectCornerID = HDLUtils.RectCornerBottomRight;
+            btnConfirm.SetCornerWithSameRadius((uint)Application.GetMinRealAverage(10), mRectCornerID);
+
+            btnCancel.MouseUpEventHandler += (sender, e) =>
+            {
+                dialog.Close();
+                cancelAction?.Invoke();
+            };
+
+            btnConfirm.MouseUpEventHandler += (sender, e) =>
+            {
+                dialog.Close();
+                okAction?.Invoke();
+            };
+
+            if (isAlarmColor)
+            {
+                btnTitle.TextColor = CSS_Color.WarningColor;
+                btnConfirm.TextColor = CSS_Color.MainBackgroundColor;
+                btnConfirm.BackgroundColor = CSS_Color.WarningColor;
+            }
+        }
+
 
         /// <summary>
         /// 鐢熸垚浜岀淮鐮�
@@ -118,7 +241,7 @@
         /// <param name="str1">鏍囬</param>
         public void QRcode(string str1)
         {
-            Dialog dialog = new Dialog() 
+            Dialog dialog = new Dialog()
             {
                 BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
             };
@@ -143,18 +266,18 @@
                 TextSize = TextSize.Text16,
                 TextAlignment = TextAlignment.Center,
                 IsBold = true,
-                TextID=StringId.linshimima,
+                TextID = StringId.linshimima,
             };
             whiteView.AddChidren(btnTitle);
             //瀵嗙爜
             Button btnpaw = new Button()
             {
-                X=Application.GetRealWidth(100),
+                X = Application.GetRealWidth(100),
                 Y = Application.GetRealHeight(62),
                 Height = Application.GetRealHeight(32),
                 Width = Application.GetRealWidth(82),
                 TextColor = MusicColor.SelectedColor,
-                TextSize =24,
+                TextSize = 24,
                 TextAlignment = TextAlignment.Center,
                 IsBold = true,
                 Text = str1,
diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs
index 1d9736b..6613907 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs
@@ -2,6 +2,7 @@
 using HDL_ON.Entity;
 using System.Collections.Generic;
 using Shared;
+using HDL_ON.DAL.Server;
 #if __IOS__
 #else
 using Com.Videogo.Hdl;
@@ -278,7 +279,65 @@
         {
             return VideDoorLockSend.Current.GetVideoDoorLockLockModelsList();
         }
+        /// <summary>
+        /// 闂ㄩ攣鎺ㄩ��
+        /// </summary>
+        /// <param name="pushMessageType"></param>
+        /// <param name="jPushMessageInfo"></param>
+        public void DoorLockPush(JPushMessageInfo jpushMessageInfo)
+        {
+            this.MainThread(() =>
+            {
+                if (string.IsNullOrEmpty(jpushMessageInfo.expantContent)) return;
+                //{ "deviceSid":"J92513662","type":"opendoormsg","extDevId":"J92513662","deviceId":"1641010144999936001","spk":"security.door.ezviz"}
+                var expantContent = Newtonsoft.Json.JsonConvert.DeserializeObject<ExpantContent>(jpushMessageInfo.expantContent);
+                if (expantContent == null)
+                {
+                    return;
+                }
+                if (expantContent.spk != SPK.VideoDoorLock)
+                {
+                    return;
+                }
+                if (jpushMessageInfo.messageType.Contains(PushMessageType.DOOR_BELL.ToString()))
+                {
+                    ///鎵撳紑瑙嗛闂ㄩ攣
+                    this.SkipRTVActivity(expantContent.devSerial, expantContent.deviceId, expantContent.spk, true);
+                }
+                else if (jpushMessageInfo.messageType.Contains(PushMessageType.Alarm.ToString()))
+                {
+                    //浣庣數閲忔帹閫�
+                    this.UpdateDoorLockState(PushMessageType.Alarm);
+                }
+                else if (jpushMessageInfo.messageType.Contains(PushMessageType.Prompt.ToString()))
+                {
+                    //寮�闂ㄦ帹閫�
+                    this.UpdateDoorLockState(PushMessageType.Prompt);
+                }
+            });
 
+        }
+        /// <summary>
+        /// 鏇存柊寮�閿佸浘鏍囧拰鐢垫睜鐘舵��
+        /// </summary>
+        private void UpdateDoorLockState(PushMessageType pushMessageType)
+        {
+            int childrenCount = MainPage.BasePageView.ChildrenCount - 1;
+            for (int i = childrenCount; childrenCount > i; i--)
+            {
+                View view = MainPage.BasePageView.GetChildren(i);
+                if (view is VideoDoorLockPage)
+                {
+                    VideoDoorLockPage videoDoorLockPage = (VideoDoorLockPage)view;
+                    if (videoDoorLockPage != null)
+                    {
+                        videoDoorLockPage.UpdateState(pushMessageType);
+                    }
+
+                }
+            }
+
+        }
         /// <summary>
         /// 鑾峰彇钀ょ煶瑙嗛銆愰棬閿併�戝垪琛�
         /// </summary>
@@ -292,37 +351,6 @@
 #endif
             return list;
         }
-
-        /// <summary>
-        /// 鏇存柊寮�閿佸浘鏍囧拰鐢垫睜鐘舵��
-        /// </summary>
-        public void UpdateDoorLockState(PushMessageType pushMessageType, string homeId, string spk, string stateContent)
-        {
-            if (spk != SPK.VideoDoorLock)
-            {
-                return;
-            }
-            this.MainThread(() =>
-            {
-                int childrenCount = MainPage.BasePageView.ChildrenCount - 1;
-                for (int i = childrenCount; childrenCount > i; i--)
-                {
-                    View view = MainPage.BasePageView.GetChildren(i);
-                    if (view is VideoDoorLockPage)
-                    {
-                        VideoDoorLockPage videoDoorLockPage = (VideoDoorLockPage)view;
-                        if (videoDoorLockPage != null)
-                        {
-                            videoDoorLockPage.UpdateState(pushMessageType);
-                        }
-
-                    }
-                }
-            });
-
-        }
-
-
         #region  --------- 鍔熻兘鏂囦欢淇濆瓨锛屽垹闄� --------
         /// <summary>
         /// 淇濆瓨鏈湴鏂囦欢
@@ -482,6 +510,8 @@
                 new PublicAssmebly().TipMsgAutoClose(msg, false, time * 1000);
             });
         }
+
+     
         #endregion
         /// <summary>
         /// 寮规绫诲瀷
diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs
index c9eec3f..42919c2 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs
@@ -214,11 +214,11 @@
                 TextAlignment = TextAlignment.Center,
                 UnSelectedImagePath = "FunctionIcon/DoorLock/Cell.png",
             };
-            cellFrame.AddChidren(btnCell); 
+            cellFrame.AddChidren(btnCell);
 
 
-             //闂ㄩ攣鐘舵��
-             btnDoorLockIcon = new Button
+            //闂ㄩ攣鐘舵��
+            btnDoorLockIcon = new Button
             {
                 X = Application.GetRealWidth(65),
                 Y = Application.GetRealHeight(108),
@@ -317,7 +317,7 @@
             //瀹炴椂瑙嗛
             this.rtvFL.SetClickListener((fl, btnStateImage, btnStateText) =>
             {
-                CommonMethod.Current.SkipRTVActivity(this.device.sid, this.device.deviceId, this.device.spk,false);
+                CommonMethod.Current.SkipRTVActivity(this.device.sid, this.device.deviceId, this.device.spk, false);
             });
             //涓存椂瀵嗙爜
             this.pswFL.SetClickListener((fl, btnStateImage, btnStateText) =>
@@ -363,7 +363,7 @@
             });
         }
 
-      
+
 
         /// <summary>
         /// 閲嶆柊璁$畻瀹藉害(璁惧鍚嶇О,鎴块棿鎺т欢)
@@ -392,15 +392,22 @@
         {
             CommonMethod.Current.MainThread(() =>
             {
-                if (this.btnDoorLockIcon != null && !this.btnDoorLockIcon.IsSelected)
+                if (pushMessageType == PushMessageType.Alarm)
                 {
-                    this.btnDoorLockIcon.IsSelected = false;
+                    //闂ㄩ攣鐢垫睜鍊�
+                    if (this.btnCell != null)
+                    {
+                        //videoDoorLockPage.btnCell.Text = "";
+                    }
                 }
-                //闂ㄩ攣鐢垫睜鍊�
-                if (this.btnCell != null)
+                else
                 {
-                    //videoDoorLockPage.btnCell.Text = "";
+                    if (this.btnDoorLockIcon != null && !this.btnDoorLockIcon.IsSelected)
+                    {
+                        this.btnDoorLockIcon.IsSelected = false;
+                    }
                 }
+
             });
 
         }

--
Gitblit v1.8.0