wxr
2021-08-28 098bc6e25ccaa85f056bd4bafe20cb669c785295
HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs
@@ -130,7 +130,8 @@
            };
            communityRow.AddChidren(btnCommunityAccessControlIcon);
            btnCommunityAccessControlIcon.MouseUpEventHandler = (sender, e) => {
            btnCommunityAccessControlIcon.MouseUpEventHandler = (sender, e) =>
            {
                if(customerObj.faceClose == 3)//没有人脸数据不能开启人脸通行功能
                {
                    return;
@@ -138,9 +139,10 @@
                btnCommunityAccessControlIcon.IsSelected = !btnCommunityAccessControlIcon.IsSelected;
                int switchStatus = btnCommunityAccessControlIcon.IsSelected == true ? 1 :2;
                //失败回调
                Action action = () => {
                    btnCommunityAccessControlIcon.IsSelected = !btnCommunityAccessControlIcon.IsSelected;
                //刷新回调
                Action action = () =>
                {
                    initButtonStatus();
                };
                editFaceInfo(switchStatus,action);
            };
@@ -175,7 +177,8 @@
                IsBold = true,
            };
            contentView.AddChidren(btnSetFaceId);
            btnSetFaceId.MouseUpEventHandler = (sender, e) => {
            btnSetFaceId.MouseUpEventHandler = (sender, e) =>
            {
                LoadPictureOptionView();
            };
@@ -193,8 +196,10 @@
                TextAlignment = TextAlignment.Center,
                IsBold = true,
            };
            btnEraseData.MouseUpEventHandler = (sender,e) => {
                Action action = () => {
            btnEraseData.MouseUpEventHandler = (sender, e) =>
            {
                Action action = () =>
                {
                    initButtonStatus();
                };
                editFaceInfo(3,action);
@@ -206,10 +211,15 @@
        /// <summary>
        /// 获取人脸信息
        /// </summary>
        void ReadFaceInfo()
        void ReadFaceInfo(bool isLoading = true)
        {
            var waitPage = new Loading();
            Loading waitPage = null;
            if (isLoading)
            {
                waitPage = new Loading();
            waitPage.Start();
            }
            new Thread(() =>
            {
                try
@@ -232,13 +242,15 @@
                        }
                    }
                }catch(Exception ex)
                }
                catch (Exception ex)
                {
                    MainPage.Log($"读取人脸信息异常:{ex.Message}");
                }
                finally
                {
                    Application.RunOnMainThread(() => {
                    Application.RunOnMainThread(() =>
                    {
                        if (waitPage != null)
                        {
                            waitPage.RemoveFromParent();
@@ -283,7 +295,8 @@
                }
                finally
                {
                    Application.RunOnMainThread(() => {
                    Application.RunOnMainThread(() =>
                    {
                        if (waitPage != null)
                        {
                            waitPage.RemoveFromParent();
@@ -411,7 +424,8 @@
            {
                pictureOptionView.Parent.RemoveFromParent();
            };
            btnTakePicture.MouseDownEventHandler = (sender, e) => {
            btnTakePicture.MouseDownEventHandler = (sender, e) =>
            {
                btnTakePicture.IsSelected = true;
            };
            btnTakePicture.MouseUpEventHandler = (sender, e) =>
@@ -421,11 +435,12 @@
                CropImage.TakePicture((imagePath) =>
                {
                    CropImageCallBack(imagePath,1,imageName);
                }, imageName, 4, 6, 1000);
                }, imageName, 4, 6, 400);
                pictureOptionView.Parent.RemoveFromParent();
            };
            btnAlbum.MouseDownEventHandler = (sender, e) => {
            btnAlbum.MouseDownEventHandler = (sender, e) =>
            {
                btnAlbum.IsSelected = true;
            };
@@ -438,14 +453,12 @@
                CropImage.SelectPicture((imagePath) =>
                {
                    CropImageCallBack(imagePath,2,imageName);
                }, imageName, 4, 6,1000);
                }, imageName, 4, 6, 400);//OutputYSize目前仅对Android有些 400代表Y的最多分辨率,所以最终得到图片的分辨率为:266*400
                pictureOptionView.Parent.RemoveFromParent();
            };
        }
        /// <summary>
@@ -462,7 +475,9 @@
            //上传成功到回调
            Action<bool> uploadSuccessAction = (isSuccess) =>
            {
                Action action = () => {
                //点击重新录入事件
                Action action = () =>
                {
                    if (!isSuccess)
                    {
                        if (imageSource == 1)
@@ -470,20 +485,23 @@
                            CropImage.TakePicture((imagePath) =>
                            {
                                CropImageCallBack(imagePath, 2, imageName);
                            }, imageName, 4, 6);
                            }, imageName, 4, 6, 400);
                        }
                        else
                        {
                            CropImage.SelectPicture((imagePath) =>
                            {
                                CropImageCallBack(imagePath, 1,imageName);
                            }, imageName, 4, 6);
                            }, imageName, 4, 6, 400);
                        }
                    }else
                    {
                        ReadFaceInfo();
                    }
                };
                if (isSuccess)
                {
                    ReadFaceInfo(false);
                }
                Application.RunOnMainThread(() =>
                {
                    var page = new FaceSettingResultPage(action);
@@ -522,6 +540,7 @@
                        var pack = new HttpServerRequest().FaceSetting(base64string);
                        if (pack != null)
                        {
                            Utlis.WriteLine("上传结果:" + pack.message);
                            uploadResultAction?.Invoke(pack.Code == StateCode.SUCCESS);
                        }