From 768287335bee13527b0fa612ec3f209d3c2089e8 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 13 七月 2023 13:28:50 +0800
Subject: [PATCH] 萤石门锁功能,人脸开锁设置

---
 HDL-ON_Android/Assets/Language.ini                                                          |   21 +
 HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_blue.png             |    0 
 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingFacePage.cs                     |  155 +++++++++++++
 HDL-ON_iOS/HDL-ON_iOS.csproj                                                                |    6 
 HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_blue.png                 |    0 
 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockFaceUnlockTriggerSettingPage.cs |  357 ++++++++++++++++++++++++++++++++
 HDL_ON/HDL_ON.projitems                                                                     |    1 
 HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_white.png                |    0 
 HDL-ON_Android/HDL-ON_Android.csproj                                                        |    6 
 HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_white.png             |    0 
 HDL_ON/DAL/Server/NewAPI.cs                                                                 |   10 
 HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/TouchUnlcokImage.png                      |    0 
 HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/FaceUnlockImage.png                       |    0 
 HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_white.png            |    0 
 HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_blue.png                |    0 
 HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_white.png               |    0 
 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingPage.cs                         |    2 
 HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/TouchUnlcokImage.png                       |    0 
 HDL_ON/Common/R.cs                                                                          |   16 +
 HDL_ON/DAL/Server/HttpServerRequest.cs                                                      |   32 ++
 HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_blue.png              |    0 
 HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/FaceUnlockImage.png                        |    0 
 22 files changed, 597 insertions(+), 9 deletions(-)

diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini
index 45ae9d4..3288112 100644
--- a/HDL-ON_Android/Assets/Language.ini
+++ b/HDL-ON_Android/Assets/Language.ini
@@ -654,7 +654,9 @@
 667=Face entry help
 668=Manual triggering
 669=Automatic triggering
-
+670=After entering the detection range, the door lock will automatically recognize the face and unlock it
+671=Note: The distance for recognizing faces is affected by the trigger sensitivity, and the higher the sensitivity, the farther the recognition distance.
+672=Need to touch the door lock number button, wake up the door lock, recognize the face, and unlock it
 
 
 
@@ -1982,6 +1984,10 @@
 667=浜鸿劯褰曞叆甯姪
 668=鎵嬪姩瑙﹀彂
 669=鑷姩瑙﹀彂
+670=杩涘叆妫�娴嬭寖鍥村悗锛岄棬閿佸皢鑷姩璇嗗埆浜鸿劯骞跺紑閿�
+671=娉細璇嗗埆浜鸿劯鐨勮窛绂伙紝浼氬彈瑙﹀彂鐏垫晱搴﹀奖鍝嶏紝鐏垫晱搴﹁秺楂橈紝璇嗗埆璺濈瓒婅繙銆�
+672=闇�瑕佽Е鎽搁棬閿佹暟瀛楁寜閿紝鍞ら啋闂ㄩ攣鍚庤瘑鍒汉鑴稿苟寮�閿�
+
 
 
 2532=璁垮閭�璇疯褰�
@@ -3307,6 +3313,12 @@
 667=Face entry help
 668=Manual triggering
 669=Automatic triggering
+670=After entering the detection range, the door lock will automatically recognize the face and unlock it
+671=Note: The distance for recognizing faces is affected by the trigger sensitivity, and the higher the sensitivity, the farther the recognition distance.
+672=Need to touch the door lock number button, wake up the door lock, recognize the face, and unlock it
+
+
+
 
 
 
@@ -4627,6 +4639,9 @@
 667=Face entry help
 668=Manual triggering
 669=Automatic triggering
+670=After entering the detection range, the door lock will automatically recognize the face and unlock it
+671=Note: The distance for recognizing faces is affected by the trigger sensitivity, and the higher the sensitivity, the farther the recognition distance.
+672=Need to touch the door lock number button, wake up the door lock, recognize the face, and unlock it
 
 
 
@@ -5937,6 +5952,10 @@
 667=Face entry help
 668=Manual triggering
 669=Automatic triggering
+670=After entering the detection range, the door lock will automatically recognize the face and unlock it
+671=Note: The distance for recognizing faces is affected by the trigger sensitivity, and the higher the sensitivity, the farther the recognition distance.
+672=Need to touch the door lock number button, wake up the door lock, recognize the face, and unlock it
+
 
 
 
diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_blue.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_blue.png
new file mode 100644
index 0000000..a902859
--- /dev/null
+++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_blue.png
Binary files differ
diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_white.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_white.png
new file mode 100644
index 0000000..f2d6a2b
--- /dev/null
+++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_white.png
Binary files differ
diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/FaceUnlockImage.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/FaceUnlockImage.png
new file mode 100644
index 0000000..43325ee
--- /dev/null
+++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/FaceUnlockImage.png
Binary files differ
diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_blue.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_blue.png
new file mode 100644
index 0000000..1406fce
--- /dev/null
+++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_blue.png
Binary files differ
diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_white.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_white.png
new file mode 100644
index 0000000..bbabf31
--- /dev/null
+++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_white.png
Binary files differ
diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/TouchUnlcokImage.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/TouchUnlcokImage.png
new file mode 100644
index 0000000..58f71c0
--- /dev/null
+++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/TouchUnlcokImage.png
Binary files differ
diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj
index be13cde..0123a86 100644
--- a/HDL-ON_Android/HDL-ON_Android.csproj
+++ b/HDL-ON_Android/HDL-ON_Android.csproj
@@ -444,6 +444,12 @@
     <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\UserRightsManagement\FaceIcon.png" />
     <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\peephole.png" />
     <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\securityipcamez.png" />
+    <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\AutomaitcTriggerIcon_blue.png" />
+    <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\AutomaitcTriggerIcon_white.png" />
+    <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\FaceUnlockImage.png" />
+    <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\ManualTriggerIcon_blue.png" />
+    <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\ManualTriggerIcon_white.png" />
+    <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\TouchUnlcokImage.png" />
   </ItemGroup>
   <ItemGroup>
     <AndroidResource Include="Resources\values\colors.xml" />
diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj
index f8df900..c5546d5 100644
--- a/HDL-ON_iOS/HDL-ON_iOS.csproj
+++ b/HDL-ON_iOS/HDL-ON_iOS.csproj
@@ -1604,6 +1604,12 @@
       <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\UserRightsManagement\FaceIcon.png" />
       <BundleResource Include="Resources\Phone\FunctionIcon\Icon\peephole.png" />
       <BundleResource Include="Resources\Phone\FunctionIcon\Icon\securityipcamez.png" />
+      <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\AutomaitcTriggerIcon_blue.png" />
+      <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\AutomaitcTriggerIcon_white.png" />
+      <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\FaceUnlockImage.png" />
+      <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\ManualTriggerIcon_blue.png" />
+      <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\ManualTriggerIcon_white.png" />
+      <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\TouchUnlcokImage.png" />
     </ItemGroup>
     <ItemGroup>
       <ITunesArtwork Include="iTunesArtwork" />
diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_blue.png
new file mode 100644
index 0000000..a902859
--- /dev/null
+++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_blue.png
Binary files differ
diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_white.png
new file mode 100644
index 0000000..f2d6a2b
--- /dev/null
+++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_white.png
Binary files differ
diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/FaceUnlockImage.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/FaceUnlockImage.png
new file mode 100644
index 0000000..43325ee
--- /dev/null
+++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/FaceUnlockImage.png
Binary files differ
diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_blue.png
new file mode 100644
index 0000000..1406fce
--- /dev/null
+++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_blue.png
Binary files differ
diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_white.png
new file mode 100644
index 0000000..bbabf31
--- /dev/null
+++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_white.png
Binary files differ
diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/TouchUnlcokImage.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/TouchUnlcokImage.png
new file mode 100644
index 0000000..58f71c0
--- /dev/null
+++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/TouchUnlcokImage.png
Binary files differ
diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs
index b8e65b0..2b4727a 100644
--- a/HDL_ON/Common/R.cs
+++ b/HDL_ON/Common/R.cs
@@ -6,6 +6,18 @@
     {
 
         /// <summary>
+        /// 闇�瑕佽Е鎽搁棬閿佹暟瀛楁寜閿紝鍞ら啋闂ㄩ攣鍚庤瘑鍒汉鑴稿苟寮�閿�
+        /// </summary>
+        public const int FaceManualUnlockTip = 672;
+        /// <summary>
+        /// 娉細璇嗗埆浜鸿劯鐨勮窛绂伙紝浼氬彈瑙﹀彂鐏垫晱搴﹀奖鍝嶏紝鐏垫晱搴﹁秺楂橈紝璇嗗埆璺濈瓒婅繙銆�
+        /// </summary>
+        public const int FaceUnlockNote = 671;
+        /// <summary>
+        /// 杩涘叆妫�娴嬭寖鍥村悗锛岄棬閿佸皢鑷姩璇嗗埆浜鸿劯骞跺紑閿�
+        /// </summary>
+        public const int FaceUnlockTip = 670;
+        /// <summary>
         /// 鑷姩瑙﹀彂
         /// </summary>
         public const int AutomaticTriggering = 669;
@@ -22,9 +34,9 @@
         /// </summary>
         public const int TriggerMode = 666;
         /// <summary>
-        /// 浜鸿劯寮�濮嬭В鏋�
+        /// 665=寮�鍚悗,璁惧鍙互杩涜浜鸿劯璇嗗埆寮�閿�
         /// </summary>
-        public const int FaceUnlockTip = 665;
+        public const int FaceUnlockOpenTip = 665;
         /// <summary>
         /// 浜鸿劯寮�閿�
         /// </summary>
diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index e7c787f..30e9b71 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -3352,6 +3352,38 @@
             return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_SetDefenceStatus, requestJson);
         }
 
+        /// <summary>
+        /// 鏌ヨ浜鸿劯寮�閿侀厤缃�
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <returns></returns>
+        public ResponsePackNew GetFaceUnlockCfg(string deviceId)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceId", deviceId);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetFaceRecognitionUnlockCfg, requestJson);
+        }
+        /// <summary>
+        /// 璁剧疆浜鸿劯寮�閿侀厤缃�
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <param name="enabled"></param>
+        /// <param name="mode">瑙i攣鏂瑰紡 0-鑷姩 1-鎵嬪姩</param>
+        /// <returns></returns>
+        public ResponsePackNew SetFaceUnlockCfg(string deviceId, bool enabled,int mode)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceId", deviceId);
+            d.Add("enabled", enabled);
+            d.Add("mode", mode);//瑙i攣鏂瑰紡 0-鑷姩 1-鎵嬪姩
+            d.Add("sensitivity", 0);//鐏垫晱搴� 0-楂� 1-浣�
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_SetFaceRecognitionUnlockCfg, requestJson);
+        }
+
         #endregion
 
         #endregion
diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs
index bab739d..fdd9472 100644
--- a/HDL_ON/DAL/Server/NewAPI.cs
+++ b/HDL_ON/DAL/Server/NewAPI.cs
@@ -957,8 +957,16 @@
         /// 璁剧疆甯冩挙闃茬姸鎬�
         /// </summary>
         public const string Api_Post_SetDefenceStatus = "/home-wisdom/platform/yingshi/lock/setDefenceStatus";
+        /// <summary>
+        /// 鏌ヨ浜鸿劯璇嗗埆瑙i攣閰嶇疆
+        /// </summary>
+        public const string Api_Post_GetFaceRecognitionUnlockCfg = "/home-wisdom/platform/yingshi/lock/getFaceRecognitionUnlockCfg";
+        /// <summary>
+        /// 璁剧疆浜鸿劯璇嗗埆瑙i攣閰嶇疆
+        /// </summary>
+        public const string Api_Post_SetFaceRecognitionUnlockCfg = "/home-wisdom/platform/yingshi/lock/setFaceRecognitionUnlockCfg";
 
-        
+
 
         #endregion
 
diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems
index 3214912..db55a35 100644
--- a/HDL_ON/HDL_ON.projitems
+++ b/HDL_ON/HDL_ON.projitems
@@ -561,6 +561,7 @@
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\VideoDoorlockUserListPage.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\UnlockSettingPage.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\UnlockSettingFacePage.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\VideoDoorlockFaceUnlockTriggerSettingPage.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" />
diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingFacePage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingFacePage.cs
index bd0cae2..090921c 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingFacePage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingFacePage.cs
@@ -1,23 +1,32 @@
 锘縰sing System;
+using HDL_ON.Common;
+using HDL_ON.DAL.Server;
+using HDL_ON.Entity;
 using HDL_ON.UI.CSS;
 using Shared;
 namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock
 {
+    /// <summary>
+    /// 钀ょ煶瑙嗛闂ㄩ攣-浜鸿劯寮�閿佽缃〉闈�
+    /// </summary>
     public class UnlockSettingFacePage : FrameLayout
     {
         FrameLayout bodyView;
         bool faceUnlockSwitch;
 
+        Function device;
 
-        public UnlockSettingFacePage()
+        public UnlockSettingFacePage(Function function)
         {
             bodyView = this;
+            device = function;
         }
 
         public void LoadPage()
         {
-            new TopViewDiv(bodyView, Language.StringByID(StringId.FaceUnlockSetting)).LoadTopView();
+            var faceUnlockSetup = new FaceUnlockSetupObj();
 
+            new TopViewDiv(bodyView, Language.StringByID(StringId.FaceUnlockSetting)).LoadTopView();
 
             var contentView = new VerticalScrolViewLayout()
             {
@@ -58,7 +67,7 @@
                 TextColor = CSS_Color.PromptingColor1,
                 TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                 IsMoreLines = true,
-                TextID = StringId.FaceUnlockTip
+                TextID = StringId.FaceUnlockOpenTip
             };
             faceUnlockView.AddChidren(btnFaceUnlockTipText);
 
@@ -73,6 +82,68 @@
                 IsSelected = faceUnlockSwitch,
             };
             faceUnlockView.AddChidren(btnFaceUnlockSwitchIcon);
+
+
+
+            var waitPage = new Loading();
+            bodyView.AddChidren(waitPage);
+            waitPage.Start("");
+
+            btnFaceUnlockSwitchIcon.MouseUpEventHandler = (sender, e) =>
+            {
+                waitPage.Start("");
+                bool changeState = false;
+                if (!btnFaceUnlockSwitchIcon.IsSelected)
+                {
+                    btnFaceUnlockSwitchIcon.IsSelected = true;
+                    changeState = true;
+                }
+                new System.Threading.Thread(() =>
+                {
+                    try
+                    {
+                        var pack = ApiUtlis.Ins.HttpRequest.SetFaceUnlockCfg(device.deviceId, changeState, faceUnlockSetup.mode);
+                        if (pack != null && pack.Code == StateCode.SUCCESS)
+                        {
+                            Application.RunOnMainThread(() =>
+                            {
+                                //鏇存柊鐣岄潰
+                                btnFaceUnlockSwitchIcon.IsSelected = changeState;
+                            });
+                        }
+                        else
+                        {
+                            //澶辫触鎻愮ず
+                            Application.RunOnMainThread(() =>
+                            {
+                                if (!string.IsNullOrEmpty(pack.message))
+                                {
+                                    var tip = new Tip()
+                                    {
+                                        MaxWidth = Application.GetRealWidth(300),
+                                        Text = $"{pack.message}({pack.Code})",
+                                        CloseTime = 3,
+                                        Direction = AMPopTipDirection.None
+                                    };
+                                    tip.Show(MainPage.BaseView);
+                                }
+                            });
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        MainPage.Log($"btnFaceUnlockSwitchIcon error : {ex.Message}");
+                    }
+                    finally
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            waitPage.Hide();
+                        });
+                    }
+                })
+                { IsBackground = true }.Start();
+            };
             #endregion
 
             contentView.AddChidren(new Button()
@@ -106,7 +177,6 @@
                 TextAlignment = TextAlignment.CenterRight,
                 TextSize = CSS_FontSize.TextFontSize,
                 TextColor = CSS_Color.PromptingColor1,
-                TextID = StringId.ManualTriggering,
             };
             triggerModeView.AddChidren(btnTriggerModeStateText);
 
@@ -122,6 +192,10 @@
 
             btnTriggerModeText.MouseUpEventHandler = (sender, e) =>
             {
+                var page = new VideoDoorlockFaceUnlockTriggerSettingPage(device, faceUnlockSetup);
+                MainPage.BasePageView.AddChidren(page);
+                page.LoadPage();
+                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
 
             };
             #endregion
@@ -170,7 +244,80 @@
 
 
 
+
+
+            new System.Threading.Thread(() => {
+                try
+                {
+                    var pack = ApiUtlis.Ins.HttpRequest.GetFaceUnlockCfg(device.deviceId);
+                    if (pack != null && pack.Code == StateCode.SUCCESS)
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            //鏇存柊鐣岄潰
+                            faceUnlockSetup = Newtonsoft.Json.JsonConvert.DeserializeObject<FaceUnlockSetupObj>(pack.Data.ToString());
+                            btnFaceUnlockSwitchIcon.IsSelected = faceUnlockSetup.enabled;
+
+                            btnTriggerModeStateText.TextID = faceUnlockSetup.mode == 0 ? StringId.AutomaticTriggering : StringId.ManualTriggering;
+                        });
+                    }
+                    else
+                    {
+                        //澶辫触鎻愮ず
+                        Application.RunOnMainThread(() =>
+                        {
+                            if (!string.IsNullOrEmpty(pack.message))
+                            {
+                                var tip = new Tip()
+                                {
+                                    MaxWidth = Application.GetRealWidth(300),
+                                    Text = $"{pack.message}({pack.Code})",
+                                    CloseTime = 3,
+                                    Direction = AMPopTipDirection.None
+                                };
+                                tip.Show(MainPage.BaseView);
+                            }
+                        });
+                    }
+
+
+                }
+                catch (Exception ex)
+                {
+                    MainPage.Log($"UnlockSettingPage error : {ex.Message}");
+                }
+                finally
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        waitPage.Hide();
+                    });
+                }
+
+            })
+            { IsBackground = true }.Start();
+
         }
 
     }
+
+    /// <summary>
+    /// 浜鸿劯寮�閿侀厤缃�
+    /// </summary>
+    public class FaceUnlockSetupObj
+    {
+        /// <summary>
+        /// 寮�鍏�
+        /// </summary>
+        public bool enabled;
+        /// <summary>
+        /// 瑙i攣鏂瑰紡 0-鑷姩 1-鎵嬪姩
+        /// </summary>
+        public int mode;
+        /// <summary>
+        /// 鐏垫晱搴� 0-楂� 1-浣�
+        /// </summary>
+        public int sensitivity;
+
+    }
 }
diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingPage.cs
index bd6fc26..0e082c7 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingPage.cs
@@ -92,7 +92,7 @@
             faceUnlockSettingView.AddChidren(btnFaceText);
 
             btnFaceText.MouseUpEventHandler = (sender, e) => {
-                var page = new UnlockSettingFacePage();
+                var page = new UnlockSettingFacePage(device);
                 MainPage.BasePageView.AddChidren(page);
                 page.LoadPage();
                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockFaceUnlockTriggerSettingPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockFaceUnlockTriggerSettingPage.cs
new file mode 100644
index 0000000..3305afc
--- /dev/null
+++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockFaceUnlockTriggerSettingPage.cs
@@ -0,0 +1,357 @@
+锘縰sing System;
+using HDL_ON.Common;
+using HDL_ON.DAL.Server;
+using HDL_ON.Entity;
+using HDL_ON.UI.CSS;
+using Shared;
+namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock
+{
+    /// <summary>
+    /// 钀ょ煶瑙嗛闂ㄩ攣-浜鸿劯寮�閿佽Е鍙戞ā寮忛厤缃晫闈�
+    /// </summary>
+    public class VideoDoorlockFaceUnlockTriggerSettingPage :FrameLayout
+    {
+        FrameLayout bodyView;
+
+        Function device;
+        FaceUnlockSetupObj faceUnlockSetup;
+        public VideoDoorlockFaceUnlockTriggerSettingPage(Function function,FaceUnlockSetupObj setupObj)
+        {
+            bodyView = this;
+            device = function;
+            faceUnlockSetup = setupObj;
+        }
+
+        public void LoadPage()
+        {
+            new TopViewDiv(bodyView, Language.StringByID(StringId.TriggerMode)).LoadTopView();
+            bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
+
+            var contentView = new FrameLayout()
+            {
+                Y = Application.GetRealHeight(64),
+                Height = Application.GetRealHeight(600),
+            };
+            bodyView.AddChidren(contentView);
+
+            #region 鑷姩瑙﹀彂
+            var autoView = new FrameLayout()
+            {
+                X = Application.GetRealWidth(16),
+                Y = Application.GetRealHeight(20),
+                Width = Application.GetRealWidth(164),
+                Height = Application.GetRealWidth(60),
+                Radius = (uint)Application.GetRealWidth(30),
+                BackgroundColor = faceUnlockSetup.mode == 0 ? CSS_Color.MainColor : CSS_Color.MainBackgroundColor,
+                BorderColor = CSS_Color.MainColor,
+            };
+            contentView.AddChidren(autoView);
+
+            var btnAutoIcon = new Button()
+            {
+                X = Application.GetRealWidth(28),
+                Gravity = Gravity.CenterVertical,
+                Width = Application.GetRealWidth(32),
+                Height = Application.GetRealWidth(32),
+                UnSelectedImagePath = faceUnlockSetup.mode == 0 ? "FunctionIcon/DoorLock/AutomaitcTriggerIcon_white.png" : "FunctionIcon/DoorLock/AutomaitcTriggerIcon_blue.png",
+            };
+            autoView.AddChidren(btnAutoIcon);
+
+            var btnAutoText = new Button
+            {
+                X = btnAutoIcon.Right + Application.GetRealWidth(4),
+                Width = Application.GetRealWidth(50),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize = CSS_FontSize.HeadlineFontSize,
+                TextColor = faceUnlockSetup.mode == 1 ? CSS_Color.MainColor : CSS_Color.MainBackgroundColor,
+            };
+            autoView.AddChidren(btnAutoText);
+            
+         
+            #endregion
+
+
+            #region 鎵嬪姩瑙﹀彂
+            var manualView = new FrameLayout()
+            {
+                X = Application.GetRealWidth(16),
+                Y = Application.GetRealHeight(20),
+                Width = Application.GetRealWidth(164),
+                Height = Application.GetRealWidth(60),
+                Radius = (uint)Application.GetRealWidth(30),
+                BackgroundColor = faceUnlockSetup.mode == 1 ? CSS_Color.MainColor : CSS_Color.MainBackgroundColor,
+                BorderColor = CSS_Color.MainColor,
+            };
+            contentView.AddChidren(manualView);
+
+            var btnManualIcon = new Button()
+            {
+                X = Application.GetRealWidth(28),
+                Gravity = Gravity.CenterVertical,
+                Width = Application.GetRealWidth(32),
+                Height = Application.GetRealWidth(32),
+                UnSelectedImagePath = faceUnlockSetup.mode == 1 ? "FunctionIcon/DoorLock/ManualTriggerIcon_white.png" : "FunctionIcon/DoorLock/ManualTriggerIcon_blue.png",
+            };
+            manualView.AddChidren(btnManualIcon);
+
+            var btnManualText = new Button
+            {
+                X = btnManualIcon.Right + Application.GetRealWidth(4),
+                Width = Application.GetRealWidth(50),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize = CSS_FontSize.HeadlineFontSize,
+                TextColor = faceUnlockSetup.mode == 0 ? CSS_Color.MainColor : CSS_Color.MainBackgroundColor,
+            };
+            manualView.AddChidren(btnManualText);
+            btnManualText.MouseUpEventHandler = (sender, e) => {
+
+            };
+            #endregion
+
+
+            btnAutoText.MouseUpEventHandler = (sender, e) =>
+            {
+                if (faceUnlockSetup.mode == 0)
+                    return;
+
+                var waitPage = new Loading();
+                bodyView.AddChidren(waitPage);
+                waitPage.Start("");
+
+                new System.Threading.Thread(() =>
+                {
+                    try
+                    {
+                        var pack = ApiUtlis.Ins.HttpRequest.SetFaceUnlockCfg(device.deviceId, faceUnlockSetup.enabled, 0);
+                        if (pack != null && pack.Code == StateCode.SUCCESS)
+                        {
+                                faceUnlockSetup.mode = 0;
+                            Application.RunOnMainThread(() =>
+                            {
+                                //鏇存柊鐣岄潰
+                                autoView.BackgroundColor = CSS_Color.MainColor;
+                                btnAutoIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/AutomaitcTriggerIcon_white.png";
+                                btnAutoText.TextColor = CSS_Color.MainBackgroundColor;
+                                manualView.BackgroundColor = CSS_Color.MainBackgroundColor;
+                                btnManualIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/ManualTriggerIcon_blue.png";
+                                btnAutoText.TextColor = CSS_Color.MainColor;
+
+                            });
+                        }
+                        else
+                        {
+                            //澶辫触鎻愮ず
+                            Application.RunOnMainThread(() =>
+                            {
+                                if (!string.IsNullOrEmpty(pack.message))
+                                {
+                                    var tip = new Tip()
+                                    {
+                                        MaxWidth = Application.GetRealWidth(300),
+                                        Text = $"{pack.message}({pack.Code})",
+                                        CloseTime = 3,
+                                        Direction = AMPopTipDirection.None
+                                    };
+                                    tip.Show(MainPage.BaseView);
+                                }
+                            });
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        MainPage.Log($"btnFaceUnlockSwitchIcon error : {ex.Message}");
+                    }
+                    finally
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            waitPage.Hide();
+                        });
+                    }
+                })
+                { IsBackground = true }.Start();
+            };
+
+
+            btnManualText.MouseUpEventHandler = (sender, e) =>
+            {
+                if (faceUnlockSetup.mode == 1)
+                    return;
+
+                var waitPage = new Loading();
+                bodyView.AddChidren(waitPage);
+                waitPage.Start("");
+
+                new System.Threading.Thread(() =>
+                {
+                    try
+                    {
+                        var pack = ApiUtlis.Ins.HttpRequest.SetFaceUnlockCfg(device.deviceId, faceUnlockSetup.enabled, 1);
+                        if (pack != null && pack.Code == StateCode.SUCCESS)
+                        {
+                            Application.RunOnMainThread(() =>
+                            {
+                                faceUnlockSetup.mode = 1;
+                                //鏇存柊鐣岄潰
+                                autoView.BackgroundColor = CSS_Color.MainBackgroundColor;
+                                btnAutoIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/AutomaitcTriggerIcon_blue.png";
+                                btnAutoText.TextColor = CSS_Color.MainColor;
+                                manualView.BackgroundColor = CSS_Color.MainColor;
+                                btnManualIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/ManualTriggerIcon_white.png";
+                                btnAutoText.TextColor = CSS_Color.MainBackgroundColor;
+
+                            });
+                        }
+                        else
+                        {
+                            //澶辫触鎻愮ず
+                            Application.RunOnMainThread(() =>
+                            {
+                                if (!string.IsNullOrEmpty(pack.message))
+                                {
+                                    var tip = new Tip()
+                                    {
+                                        MaxWidth = Application.GetRealWidth(300),
+                                        Text = $"{pack.message}({pack.Code})",
+                                        CloseTime = 3,
+                                        Direction = AMPopTipDirection.None
+                                    };
+                                    tip.Show(MainPage.BaseView);
+                                }
+                            });
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        MainPage.Log($"btnFaceUnlockSwitchIcon error : {ex.Message}");
+                    }
+                    finally
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            waitPage.Hide();
+                        });
+                    }
+                })
+                { IsBackground = true }.Start();
+            };
+
+
+            loadAutomaitcTipView();
+            loadManualTipView();
+
+            if(faceUnlockSetup.mode == 0)
+            {
+                automaitcView.Visible = true;
+                manualView.Visible = false;
+            }
+            else
+            {
+                automaitcView.Visible = false;
+                manualView.Visible = true;
+            }
+
+        }
+        FrameLayout automaitcView;
+        FrameLayout manualView;
+
+        /// <summary>
+        /// 鍔犺浇鑷姩瑙﹀彂鏂瑰紡鎻愮ず
+        /// </summary>
+        void loadAutomaitcTipView()
+        {
+            automaitcView = new FrameLayout()
+            {
+                Y = Application.GetRealHeight(128),
+                Height = Application.GetRealHeight(667 - 128 - 64),
+                BackgroundColor = CSS_Color.MainBackgroundColor
+            };
+            bodyView.AddChidren(automaitcView);
+
+            var btnAutomaitcImage = new Button()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(200),
+                Height = Application.GetRealWidth(200),
+                UnSelectedImagePath = "FunctionIcon/DoorLock/FaceUnlockImage.png",
+            };
+            automaitcView.AddChidren(btnAutomaitcImage);
+
+            var btnAutomaitcTip = new Button()
+            {
+                Width = Application.GetRealWidth(343),
+                Height = Application.GetRealHeight(30),
+                Gravity = Gravity.CenterHorizontal,
+                Y = btnAutomaitcImage.Bottom,
+                TextSize = CSS_FontSize.TextFontSize,
+                TextColor = CSS_Color.FirstLevelTitleColor,
+                TextAlignment = TextAlignment.TopCenter,
+                IsMoreLines = true,
+                TextID = StringId.FaceUnlockTip
+            };
+            automaitcView.AddChidren(btnAutomaitcTip);
+
+            var btnAutomaitcNote = new Button()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Y = Application.GetRealHeight(400),
+                Width = Application.GetRealWidth(343),
+                Height = Application.GetRealHeight(50),
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                TextColor = CSS_Color.PromptingColor1,
+                TextID = StringId.FaceUnlockNote,
+            };
+            automaitcView.AddChidren(btnAutomaitcNote);
+
+        }
+        /// <summary>
+        /// 鍔犺浇鎵嬪姩瑙﹀彂鏂瑰紡鎻愮ず
+        /// </summary>
+        void loadManualTipView()
+        {
+            manualView = new FrameLayout()
+            {
+                Y = Application.GetRealHeight(128),
+                Height = Application.GetRealHeight(667 - 128 - 64),
+                BackgroundColor = CSS_Color.MainBackgroundColor
+            };
+            bodyView.AddChidren(manualView);
+
+            var btnImage1 = new Button()
+            {
+                X = Application.GetRealWidth(16),
+                Y = Application.GetRealHeight(31),
+                Gravity = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(160),
+                Height = Application.GetRealWidth(160),
+                UnSelectedImagePath = "FunctionIcon/DoorLock/TouchUnlcokImage.png",
+            };
+            manualView.AddChidren(btnImage1);
+
+            var btnAutomaitcImage = new Button()
+            {
+                X = btnImage1.Right + Application.GetRealWidth(24),
+                Y = Application.GetRealHeight(31),
+                Gravity = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(160),
+                Height = Application.GetRealWidth(160),
+                UnSelectedImagePath = "FunctionIcon/DoorLock/FaceUnlockImage.png",
+            };
+            manualView.AddChidren(btnAutomaitcImage);
+
+            var btnManualTip = new Button()
+            {
+                Width = Application.GetRealWidth(343),
+                Height = Application.GetRealHeight(30),
+                Gravity = Gravity.CenterHorizontal,
+                Y = btnAutomaitcImage.Bottom,
+                TextSize = CSS_FontSize.TextFontSize,
+                TextColor = CSS_Color.FirstLevelTitleColor,
+                TextAlignment = TextAlignment.TopCenter,
+                IsMoreLines = true,
+                TextID = StringId.FaceManualUnlockTip
+            };
+            manualView.AddChidren(btnManualTip);
+        }
+    }
+}

--
Gitblit v1.8.0