From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期五, 28 二月 2020 15:25:13 +0800 Subject: [PATCH] 2020.2.28 --- ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs | 160 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 138 insertions(+), 22 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs index d8d38b6..8998b82 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs @@ -8,6 +8,11 @@ /// </summary> public class UserInformationForm : EditorCommonForm { + /// <summary> + /// 涓儴妗屽竷鎺т欢 + /// </summary> + private FrameLayout frameMiddleBack = null; + #region 鈻� 鍒濆鍖朹____________________________ /// <summary> @@ -46,20 +51,18 @@ bodyFrameLayout.AddChidren(specialTopFrame); //鐢ㄦ埛鍥炬爣 - var btnUserIcon = new CutPictureControl(UserCenterResourse.UserInfo.UserIconFile, 251, 251, true); + var btnUserIcon = new ImageView(); + btnUserIcon.Height = Application.GetMinRealAverage(251); + btnUserIcon.Width = Application.GetMinRealAverage(251); btnUserIcon.Radius = (uint)Application.GetMinRealAverage(251) / 2; btnUserIcon.Y = Application.GetRealHeight(46); btnUserIcon.Gravity = Gravity.CenterHorizontal; - btnUserIcon.ImagePath = UserCenterResourse.UserInfo.UserIconFile; + btnUserIcon.ImageBytes = Shared.IO.FileUtils.ReadFile(UserCenterResourse.UserInfo.UserIconFile); specialTopFrame.AddChidren(btnUserIcon); - btnUserIcon.SelectPictrueEvent += async (selectPic) => + btnUserIcon.MouseUpEventHandler += (sender, e) => { - var pra = new { HeadImage = Shared.IO.FileUtils.ReadFile(selectPic) }; - var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpdateHeadImage", false, pra); - if (result == true) - { - UserCenterResourse.UserInfo.UserIconFileChanged = true; - } + //鏄剧ず鑾峰彇鍥剧墖鏉ユ簮鑿滃崟 + this.ShowUserIconMenu(btnUserIcon); }; } @@ -72,23 +75,30 @@ /// </summary> private void InitMiddleBodyFrame() { - var frameBack = new FrameLayout(); - frameBack.Y = Application.GetRealHeight(363); - frameBack.Height = Application.GetRealHeight(1008); - frameBack.BackgroundColor = UserCenterColor.Current.White; - bodyFrameLayout.AddChidren(frameBack); + if (this.frameMiddleBack == null) + { + frameMiddleBack = new FrameLayout(); + frameMiddleBack.Y = Application.GetRealHeight(363); + frameMiddleBack.Height = Application.GetRealHeight(1008); + frameMiddleBack.BackgroundColor = UserCenterColor.Current.White; + bodyFrameLayout.AddChidren(frameMiddleBack); + } + else + { + frameMiddleBack.RemoveAll(); + } var listMidFrame = new FrameListControl(12); listMidFrame.Y = Application.GetRealHeight(11); listMidFrame.Height = Application.GetRealHeight(1008 - 11); - frameBack.AddChidren(listMidFrame); + frameMiddleBack.AddChidren(listMidFrame); var rowName = new FrameRowControl(listMidFrame.rowSpace / 2); //鍏抽棴鐐瑰嚮鐘舵�� rowName.UseClickStatu = false; listMidFrame.AddChidren(rowName); //搴曠嚎 - rowName.AddBottomLine(); + var btnNameLine = rowName.AddBottomLine(); //鍚嶇ОView rowName.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uName), 350); //鍚嶇О杈撳叆 @@ -111,6 +121,8 @@ //鏇存柊鐢ㄦ埛鍚� this.SaveUserName(txtName.Text.Trim()); }); + //鑱斿姩绾跨殑鐘舵�� + txtName.btnLine = btnNameLine; var rowQrCode = new FrameRowControl(listMidFrame.rowSpace / 2); listMidFrame.AddChidren(rowQrCode); @@ -172,7 +184,17 @@ } else { - btnPhone.Text = "+" + UserCenterResourse.UserInfo.AreaCode + " " + UserCenterResourse.UserInfo.Phone; + string phoneNum = UserCenterResourse.UserInfo.Phone; + if (phoneNum.Length >= 11) + { + phoneNum = phoneNum.Substring(0, 3) + "".PadLeft(phoneNum.Length - 7, '*') + phoneNum.Substring(phoneNum.Length - 4, 4); + } + else if (phoneNum.Length >= 5) + { + //鎴栬杩欐槸鍥藉鐨勬墜鏈哄惂 + phoneNum = phoneNum.Substring(0, 3) + "".PadLeft(phoneNum.Length - 5, '*') + phoneNum.Substring(phoneNum.Length - 2, 2); + } + btnPhone.Text = "+" + UserCenterResourse.UserInfo.AreaCode + " " + phoneNum; } rowPhone.ButtonClickEvent += (sender, e) => { @@ -198,7 +220,8 @@ //娣诲姞鍚戝彸鍥炬爣 rowOther.AddRightArrow(); //寰俊銆丵Q - rowOther.AddMostRightView(Language.StringByID(R.MyInternationalizationString.uWebChatAndQQ), 500); + //var btnQQ = rowOther.AddMostRightView(Language.StringByID(R.MyInternationalizationString.uWebChatAndQQ), 500); + var btnQQ = rowOther.AddMostRightView(Language.StringByID(R.MyInternationalizationString.uWebChat), 500); rowOther.ButtonClickEvent += (sender, e) => { var form = new OtherParty.OtherPartyAccountMenuForm(); @@ -214,7 +237,7 @@ //娣诲姞鍚戝彸鍥炬爣 rowSysPsw.AddRightArrow(); //鍘讳慨鏀� - rowSysPsw.AddMostRightView(Language.StringByID(R.MyInternationalizationString.uGotoEditor), 350); + var btnPsw = rowSysPsw.AddMostRightView(Language.StringByID(R.MyInternationalizationString.uGotoEditor), 350); rowSysPsw.ButtonClickEvent += (sender, e) => { var form = new Password.EditorAccountPasswordForm(); @@ -228,7 +251,7 @@ //娣诲姞鍚戝彸鍥炬爣 rowSecond.AddRightArrow(); //瀵嗙爜銆佹墜鍔裤�佹寚绾� - rowSecond.AddMostRightView(Language.StringByID(R.MyInternationalizationString.uPasswordGestureFingerPrint), 400); + var btnSecand = rowSecond.AddMostRightView(Language.StringByID(R.MyInternationalizationString.uPasswordGestureFingerPrint), 400); rowSecond.ButtonClickEvent += (sender, e) => { var form = new SecondAuthenticationForm(); @@ -252,6 +275,7 @@ //閫�鍑虹櫥闄� var btnLogout = new NormalClickButton(specialFrame.Width, specialFrame.Height); + btnLogout.clickStatuColor = 0xfffbfbfb; btnLogout.TextID = R.MyInternationalizationString.uLogoutAccount; btnLogout.TextColor = 0xff666666; btnLogout.BackgroundColor = UserCenterColor.Current.White; @@ -306,6 +330,98 @@ #endregion + #region 鈻� 鏄剧ず鑾峰彇鍥剧墖鏉ユ簮鑿滃崟_______________ + + /// <summary> + /// 鏄剧ず鑾峰彇鍥剧墖鏉ユ簮鑿滃崟 + /// </summary> + /// <param name="btnUser"></param> + private void ShowUserIconMenu(ImageView btnUser) + { + var menuContr = new BottomMenuSelectForm(); + menuContr.AddForm(2); + //鎷嶇収 + menuContr.AddMenu(Language.StringByID(R.MyInternationalizationString.uTakePictrue), () => + { + //閫氳繃鐩告満鎷嶇収瑁佸壀 + CropImage.TakePicture((imagePath) => + { + if (string.IsNullOrEmpty(imagePath) == false) + { + //绉诲姩鐢ㄦ埛澶村儚鏂囦欢 + if (this.MoveUserIconFile(imagePath) == true) + { + //涓婁紶鐢ㄦ埛澶村儚鏂囦欢 + this.UpLoadUserIconFile(btnUser, UserCenterResourse.UserInfo.UserIconFile); + } + } + }, "HdlPicture"); + }); + //浠庣浉鍐屼腑閫夋嫨 + menuContr.AddMenu(Language.StringByID(R.MyInternationalizationString.uGetPictrueFromAlbum), () => + { + //浠庣浉鍐岄�夋嫨鍥剧墖瑁佸壀 + CropImage.SelectPicture((imagePath) => + { + if (string.IsNullOrEmpty(imagePath) == false) + { + //绉诲姩鐢ㄦ埛澶村儚鏂囦欢 + if (this.MoveUserIconFile(imagePath) == true) + { + //涓婁紶鐢ㄦ埛澶村儚鏂囦欢 + this.UpLoadUserIconFile(btnUser, UserCenterResourse.UserInfo.UserIconFile); + } + } + }, "HdlPicture"); + }); + } + + /// <summary> + /// 涓婁紶鐢ㄦ埛澶村儚鏂囦欢 + /// </summary> + /// <param name="btnUser"></param> + /// <param name="imagePath"></param> + private async void UpLoadUserIconFile(ImageView btnUser, string imagePath) + { + var pra = new { HeadImage = Shared.IO.FileUtils.ReadFile(imagePath) }; + var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpdateHeadImage", false, pra); + if (result == true) + { + UserCenterResourse.UserInfo.UserIconFileChanged = true; + btnUser.ImageBytes = Shared.IO.FileUtils.ReadFile(imagePath); + } + } + + /// <summary> + /// 绉诲姩鐢ㄦ埛澶村儚鏂囦欢 + /// </summary> + /// <param name="imagePath"></param> + /// <returns></returns> + private bool MoveUserIconFile(string imagePath) + { + try + { + if (System.IO.File.Exists(UserCenterResourse.UserInfo.UserIconFile) == true) + { + System.IO.File.Delete(UserCenterResourse.UserInfo.UserIconFile); + } + //绉诲姩鏂囦欢 + System.IO.File.Move(imagePath, UserCenterResourse.UserInfo.UserIconFile); + return true; + } + catch (Exception ex) + { + //鍑虹幇鏈煡閿欒 + var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError)); + alert.Show(); + //Log + HdlLogLogic.Current.WriteLog(ex); + return false; + } + } + + #endregion + #region 鈻� 鐣岄潰閲嶆柊婵�娲讳簨浠禵__________________ /// <summary> @@ -313,8 +429,8 @@ /// </summary> public override int FormActionAgainEvent() { - //閲嶆柊鍒锋柊鐣岄潰 - this.ShowForm(); + //鍒濆鍖栦腑閮ㄧ殑淇℃伅 + this.InitMiddleBodyFrame(); return 1; } -- Gitblit v1.8.0