From e1a8f2f7e4d850beedeb1469610b878c1427e976 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 15 十二月 2021 09:01:53 +0800 Subject: [PATCH] 更新 --- HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs | 115 ++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 72 insertions(+), 43 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs index 870c50b..58570c9 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs @@ -41,6 +41,16 @@ Button btnCancel; #endregion + /// <summary> + /// imageHeight + /// OutputYSize 400浠h〃Y鍒嗚鲸鐜囬珮鐨勫�硷紝鎵�浠ユ渶缁堝緱鍒板浘鐗囩殑鍒嗚鲸鐜囦负锛�266*400 + /// 0浠h〃涓嶆寚瀹氫笉鍘嬬缉,鐩存帴淇濆瓨瑁佸壀鍚庣殑鍥剧墖锛岀洰鍓嶅彧瀵筰OS鏈夋晥 Android璁剧疆灏忎簬0鐨勮瘽榛樿800 + /// </summary> +#if __IOS__ + const int imageHeight = 0; +#else + const int imageHeight = 400; +#endif @@ -63,7 +73,7 @@ contentView = new FrameLayout() { Y = Application.GetRealHeight(64), - Height = Application.GetRealHeight(667-64), + Height = Application.GetRealHeight(667 - 64), }; bodyView.AddChidren(contentView); @@ -96,9 +106,9 @@ }; topView.AddChidren(btnText1); - topView.AddChidren(new Button() { Height = 1,BackgroundColor = CSS_Color.DividingLineColor,Y = Application.GetRealHeight(188) ,X = Application.GetRealWidth(16),Width = Application.GetRealWidth(359)}); + topView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor, Y = Application.GetRealHeight(188), X = Application.GetRealWidth(16), Width = Application.GetRealWidth(359) }); - #region 绀惧尯闂ㄧ閫氳 +#region 绀惧尯闂ㄧ閫氳 var communityRow = new FrameLayout() { Y = topView.Bottom, @@ -130,22 +140,24 @@ }; communityRow.AddChidren(btnCommunityAccessControlIcon); - btnCommunityAccessControlIcon.MouseUpEventHandler = (sender, e) => { - if(customerObj.faceClose == 3)//娌℃湁浜鸿劯鏁版嵁涓嶈兘寮�鍚汉鑴搁�氳鍔熻兘 + btnCommunityAccessControlIcon.MouseUpEventHandler = (sender, e) => + { + if (customerObj.faceClose == 3)//娌℃湁浜鸿劯鏁版嵁涓嶈兘寮�鍚汉鑴搁�氳鍔熻兘 { return; } btnCommunityAccessControlIcon.IsSelected = !btnCommunityAccessControlIcon.IsSelected; - int switchStatus = btnCommunityAccessControlIcon.IsSelected == true ? 1 :2; + int switchStatus = btnCommunityAccessControlIcon.IsSelected == true ? 1 : 2; - //澶辫触鍥炶皟 - Action action = () => { - btnCommunityAccessControlIcon.IsSelected = !btnCommunityAccessControlIcon.IsSelected; + //鍒锋柊鍥炶皟 + Action action = () => + { + initButtonStatus(); }; - editFaceInfo(switchStatus,action); + editFaceInfo(switchStatus, action); }; - #endregion +#endregion var btnTip = new Button() @@ -175,10 +187,11 @@ IsBold = true, }; contentView.AddChidren(btnSetFaceId); - btnSetFaceId.MouseUpEventHandler = (sender, e) => { + btnSetFaceId.MouseUpEventHandler = (sender, e) => + { LoadPictureOptionView(); }; - + //鎶规帀鏁版嵁 btnEraseData = new Button() { Y = Application.GetRealHeight(481), @@ -193,11 +206,13 @@ TextAlignment = TextAlignment.Center, IsBold = true, }; - btnEraseData.MouseUpEventHandler = (sender,e) => { - Action action = () => { + btnEraseData.MouseUpEventHandler = (sender, e) => + { + Action action = () => + { initButtonStatus(); }; - editFaceInfo(3,action); + editFaceInfo(3, action); }; ReadFaceInfo(); @@ -206,10 +221,15 @@ /// <summary> /// 鑾峰彇浜鸿劯淇℃伅 /// </summary> - void ReadFaceInfo() + void ReadFaceInfo(bool isLoading = true) { - var waitPage = new Loading(); - waitPage.Start(); + Loading waitPage = null; + if (isLoading) + { + waitPage = new Loading(); + waitPage.Start(); + } + new Thread(() => { try @@ -232,13 +252,15 @@ } } - }catch(Exception ex) + } + catch (Exception ex) { MainPage.Log($"璇诲彇浜鸿劯淇℃伅寮傚父:{ex.Message}"); } finally { - Application.RunOnMainThread(() => { + Application.RunOnMainThread(() => + { if (waitPage != null) { waitPage.RemoveFromParent(); @@ -252,7 +274,7 @@ /// <summary> /// 娓呴櫎浜鸿劯鏁版嵁 /// </summary> - void editFaceInfo(int status,Action action) + void editFaceInfo(int status, Action action) { var waitPage = new Loading(); waitPage.Start(); @@ -283,7 +305,8 @@ } finally { - Application.RunOnMainThread(() => { + Application.RunOnMainThread(() => + { if (waitPage != null) { waitPage.RemoveFromParent(); @@ -311,9 +334,9 @@ return; } } - btnCommunityAccessControlIcon.IsSelected = false; - btnEraseData.RemoveFromParent(); - btnSetFaceId.TextID = StringId.SetFace; + btnCommunityAccessControlIcon.IsSelected = false; + btnEraseData.RemoveFromParent(); + btnSetFaceId.TextID = StringId.SetFace; } @@ -332,7 +355,7 @@ pictureOptionView = new FrameLayout() { - Y = Application.GetRealHeight(445+50), + Y = Application.GetRealHeight(445 + 50), Height = Application.GetRealHeight(250), AnimateSpeed = 0.3f, Animate = Animate.DownToUp, @@ -411,7 +434,8 @@ { pictureOptionView.Parent.RemoveFromParent(); }; - btnTakePicture.MouseDownEventHandler = (sender, e) => { + btnTakePicture.MouseDownEventHandler = (sender, e) => + { btnTakePicture.IsSelected = true; }; btnTakePicture.MouseUpEventHandler = (sender, e) => @@ -420,12 +444,13 @@ var imageName = Guid.NewGuid().ToString(); CropImage.TakePicture((imagePath) => { - CropImageCallBack(imagePath,1,imageName); - }, imageName, 4, 6, 400); + CropImageCallBack(imagePath, 1, imageName); + }, imageName, 4, 6, imageHeight); pictureOptionView.Parent.RemoveFromParent(); }; - btnAlbum.MouseDownEventHandler = (sender, e) => { + btnAlbum.MouseDownEventHandler = (sender, e) => + { btnAlbum.IsSelected = true; }; @@ -437,8 +462,8 @@ //var imageName = scene.sid; CropImage.SelectPicture((imagePath) => { - CropImageCallBack(imagePath,2,imageName); - }, imageName, 4, 6, 400); + CropImageCallBack(imagePath, 2, imageName); + }, imageName, 4, 6, imageHeight); pictureOptionView.Parent.RemoveFromParent(); }; @@ -446,14 +471,12 @@ } - - /// <summary> /// 瑁佸壀瀹岀収鐗囧洖璋冿紝缁熶竴澶勭悊 /// </summary> /// <param name="imagePath">瑁佸壀鍚庣殑鐪熷疄璺緞</param> /// <param name="imageSource">鐓х墖鏉ユ簮锛�1锛氭媿鐓э紱2锛氬浘搴�</param> - void CropImageCallBack(string selectImagePath,int imageSource,string imageName) + void CropImageCallBack(string selectImagePath, int imageSource, string imageName) { if (string.IsNullOrEmpty(selectImagePath) == true) { @@ -462,7 +485,9 @@ //涓婁紶鎴愬姛鍒板洖璋� Action<bool> uploadSuccessAction = (isSuccess) => { - Action action = () => { + //鐐瑰嚮閲嶆柊褰曞叆浜嬩欢 + Action action = () => + { if (!isSuccess) { if (imageSource == 1) @@ -470,20 +495,23 @@ CropImage.TakePicture((imagePath) => { CropImageCallBack(imagePath, 2, imageName); - }, imageName, 4, 6, 400); + }, imageName, 4, 6, imageHeight); } else { CropImage.SelectPicture((imagePath) => { - CropImageCallBack(imagePath, 1,imageName); - }, imageName, 4, 6, 400); + CropImageCallBack(imagePath, 1, imageName); + }, imageName, 4, 6, imageHeight); } - }else - { - ReadFaceInfo(); } }; + + if (isSuccess) + { + ReadFaceInfo(false); + } + Application.RunOnMainThread(() => { var page = new FaceSettingResultPage(action); @@ -519,6 +547,7 @@ try { string base64string = Convert.ToBase64String(imageBytes); + //Utlis.WriteLine("涓婁紶鍥剧墖Length:" + imageBytes.Length + " base64锛�" + base64string); var pack = new HttpServerRequest().FaceSetting(base64string); if (pack != null) { -- Gitblit v1.8.0