wxr
2023-07-13 768287335bee13527b0fa612ec3f209d3c2089e8
萤石门锁功能,人脸开锁设置
13个文件已添加
9个文件已修改
606 ■■■■■ 已修改文件
HDL-ON_Android/Assets/Language.ini 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_blue.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_white.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/FaceUnlockImage.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_blue.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_white.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/TouchUnlcokImage.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/HDL-ON_Android.csproj 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/HDL-ON_iOS.csproj 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_blue.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_white.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/FaceUnlockImage.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_blue.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_white.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/TouchUnlcokImage.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/R.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/HttpServerRequest.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/NewAPI.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/HDL_ON.projitems 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingFacePage.cs 155 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingPage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockFaceUnlockTriggerSettingPage.cs 357 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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
HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_blue.png
HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_white.png
HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/FaceUnlockImage.png
HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_blue.png
HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_white.png
HDL-ON_Android/Assets/Phone/FunctionIcon/DoorLock/TouchUnlcokImage.png
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" />
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" />
HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_blue.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/AutomaitcTriggerIcon_white.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/FaceUnlockImage.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_blue.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/ManualTriggerIcon_white.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/DoorLock/TouchUnlcokImage.png
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>
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">解锁方式 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);//解锁方式 0-自动 1-手动
            d.Add("sensitivity", 0);//灵敏度 0-高 1-低
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_SetFaceRecognitionUnlockCfg, requestJson);
        }
        #endregion
        #endregion
HDL_ON/DAL/Server/NewAPI.cs
@@ -957,8 +957,16 @@
        /// 设置布撤防状态
        /// </summary>
        public const string Api_Post_SetDefenceStatus = "/home-wisdom/platform/yingshi/lock/setDefenceStatus";
        /// <summary>
        /// 查询人脸识别解锁配置
        /// </summary>
        public const string Api_Post_GetFaceRecognitionUnlockCfg = "/home-wisdom/platform/yingshi/lock/getFaceRecognitionUnlockCfg";
        /// <summary>
        /// 设置人脸识别解锁配置
        /// </summary>
        public const string Api_Post_SetFaceRecognitionUnlockCfg = "/home-wisdom/platform/yingshi/lock/setFaceRecognitionUnlockCfg";
        #endregion
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\" />
HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/UnlockSettingFacePage.cs
@@ -1,23 +1,32 @@
using 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>
        /// 解锁方式 0-自动 1-手动
        /// </summary>
        public int mode;
        /// <summary>
        /// 灵敏度 0-高 1-低
        /// </summary>
        public int sensitivity;
    }
}
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;
HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockFaceUnlockTriggerSettingPage.cs
New file
@@ -0,0 +1,357 @@
using 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);
        }
    }
}