From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期二, 30 八月 2022 09:37:38 +0800 Subject: [PATCH] 合并了IOS的代码 --- ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs | 87 +++++++++++++++++++++++++++---------------- 1 files changed, 55 insertions(+), 32 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs index 8998b82..faa609b 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs @@ -11,7 +11,7 @@ /// <summary> /// 涓儴妗屽竷鎺т欢 /// </summary> - private FrameLayout frameMiddleBack = null; + private NormalFrameLayout frameMiddleBack = null; #region 鈻� 鍒濆鍖朹____________________________ @@ -20,6 +20,9 @@ /// </summary> public void ShowForm() { + //璁颁綇瀹冨師鏉ョ殑鏄电О + UserCenterResourse.UserInfo.OldUserName = UserCenterResourse.UserInfo.UserName; + //鍥犱负鍒殑鐢婚潰浼氳皟鐢ㄨ繖涓嚱鏁帮紝鐒跺悗鍒锋柊鐢婚潰 this.ClearBodyFrame(); @@ -52,9 +55,9 @@ //鐢ㄦ埛鍥炬爣 var btnUserIcon = new ImageView(); - btnUserIcon.Height = Application.GetMinRealAverage(251); - btnUserIcon.Width = Application.GetMinRealAverage(251); - btnUserIcon.Radius = (uint)Application.GetMinRealAverage(251) / 2; + btnUserIcon.Height = this.GetPictrueRealSize(251); + btnUserIcon.Width = this.GetPictrueRealSize(251); + btnUserIcon.Radius = (uint)this.GetPictrueRealSize(251) / 2; btnUserIcon.Y = Application.GetRealHeight(46); btnUserIcon.Gravity = Gravity.CenterHorizontal; btnUserIcon.ImageBytes = Shared.IO.FileUtils.ReadFile(UserCenterResourse.UserInfo.UserIconFile); @@ -77,9 +80,9 @@ { if (this.frameMiddleBack == null) { - frameMiddleBack = new FrameLayout(); + frameMiddleBack = new NormalFrameLayout(); frameMiddleBack.Y = Application.GetRealHeight(363); - frameMiddleBack.Height = Application.GetRealHeight(1008); + frameMiddleBack.Height = Application.GetRealHeight(1008) - ControlCommonResourse.ListViewRowHeight - Application.GetRealHeight(12); frameMiddleBack.BackgroundColor = UserCenterColor.Current.White; bodyFrameLayout.AddChidren(frameMiddleBack); } @@ -102,7 +105,9 @@ //鍚嶇ОView rowName.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uName), 350); //鍚嶇О杈撳叆 - var txtName = new TextInputExControl(700, true); + var txtName = new TextInputControl(700, true); + txtName.MaxByte = 36;//闄愬埗36涓瓧鑺� + txtName.UseFocusColor = true; txtName.X = bodyFrameLayout.Width - Application.GetRealWidth(700) - ControlCommonResourse.XXLeft; txtName.Gravity = Gravity.CenterVertical; txtName.TextAlignment = TextAlignment.CenterRight; @@ -112,15 +117,27 @@ //杈撳叆缁撴潫浜嬩欢 txtName.FinishInputEvent += (() => { - if (txtName.Text.Trim() == string.Empty) - { - //鎶婂悕绉拌繕鍘熷洖鍘� - txtName.Text = UserCenterResourse.UserInfo.UserName; - return; - } //鏇存柊鐢ㄦ埛鍚� - this.SaveUserName(txtName.Text.Trim()); + this.SaveUserName(txtName, true); }); + //杈撳叆鍊兼敼鍙樹簨浠�(2020.04.05:浠ュ墠閮藉畾姝昏鎸夊洖杞﹂敭鎵嶆洿鏂�,鐜板湪鍙堣鍚嶅瓧娌℃湁鍚屾 + //鎵�浠ユ墠鍑烘涓嬬瓥,娣诲姞杩欎釜浜嬩欢) + txtName.TextChangedEvent += (value) => + { + UserCenterResourse.UserInfo.UserName = value; + }; + //鍏夋爣鏀瑰彉浜嬩欢(2020.04.05:浠ュ墠閮藉畾姝昏鎸夊洖杞﹂敭鎵嶆洿鏂�,鐜板湪鍙堣鍚嶅瓧娌℃湁鍚屾 + //鎵�浠ユ墠鍑烘涓嬬瓥,娣诲姞杩欎釜浜嬩欢) + txtName.FoucsChanged += (sender, focusEvent) => + { + //鍏夋爣绂诲紑鏃�,鎵ц鍚嶅瓧淇敼 + if (focusEvent.Focus == false) + { + //鏇存柊鐢ㄦ埛鍚� + this.SaveUserName(txtName, false); + } + }; + //鑱斿姩绾跨殑鐘舵�� txtName.btnLine = btnNameLine; @@ -212,7 +229,7 @@ var rowOther = new FrameRowControl(listMidFrame.rowSpace / 2); - listMidFrame.AddChidren(rowOther); + //listMidFrame.AddChidren(rowOther); //绗笁鏂硅处鍙� rowOther.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uAuthenticatedOtherPartyAccount), 400); //搴曠嚎 @@ -269,7 +286,7 @@ { var specialFrame = new FrameLayout(); specialFrame.Height = ControlCommonResourse.ListViewRowHeight; - specialFrame.Y = Application.GetRealHeight(1394); + specialFrame.Y = Application.GetRealHeight(1394) - ControlCommonResourse.ListViewRowHeight - Application.GetRealHeight(12); specialFrame.BackgroundColor = UserCenterColor.Current.White; bodyFrameLayout.AddChidren(specialFrame); @@ -300,32 +317,38 @@ /// <summary> /// 鏇存柊鐢ㄦ埛鍚� /// </summary> - /// <param name="userName">鏄电О</param> - private async void SaveUserName(string userName) + /// <param name="txtName"></param> + private void SaveUserName(TextInputControl txtName, bool showMsg) { - if (UserCenterResourse.UserInfo.UserName == userName) + if (UserCenterResourse.UserInfo.UserName == string.Empty) { + //鎶婂悕绉拌繕鍘熷洖鍘� + txtName.Text = UserCenterResourse.UserInfo.OldUserName; + UserCenterResourse.UserInfo.UserName = UserCenterResourse.UserInfo.OldUserName; return; } - //鎵撳紑杩涘害鏉� - this.ShowProgressBar(); - + if (UserCenterResourse.UserInfo.OldUserName == UserCenterResourse.UserInfo.UserName) + { + //鏃犻渶淇敼 + return; + } var pra = new SaveUserNamePra(); - pra.UserName = userName; + pra.UserName = UserCenterResourse.UserInfo.UserName; - bool result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpdateUserName", false, pra); - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); + bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpdateUserName", false, pra); if (result == false) { return; } - //鐢ㄦ埛鍚嶇О淇敼鎴愬姛! - string msg = Language.StringByID(R.MyInternationalizationString.uUserNameSaveSuccess); - this.ShowMassage(ShowMsgType.Tip, msg); + if (showMsg == true) + { + //鐢ㄦ埛鍚嶇О淇敼鎴愬姛! + string msg = Language.StringByID(R.MyInternationalizationString.uUserNameSaveSuccess); + this.ShowMassage(ShowMsgType.Tip, msg); + } - UserCenterResourse.UserInfo.UserName = userName; + UserCenterResourse.UserInfo.OldUserName = UserCenterResourse.UserInfo.UserName; } #endregion @@ -381,10 +404,10 @@ /// </summary> /// <param name="btnUser"></param> /// <param name="imagePath"></param> - private async void UpLoadUserIconFile(ImageView btnUser, string imagePath) + private void UpLoadUserIconFile(ImageView btnUser, string imagePath) { var pra = new { HeadImage = Shared.IO.FileUtils.ReadFile(imagePath) }; - var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpdateHeadImage", false, pra); + var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpdateHeadImage", false, pra); if (result == true) { UserCenterResourse.UserInfo.UserIconFileChanged = true; -- Gitblit v1.8.0