HDL Home App 第二版本 旧平台金堂用 正在使用
hxb
2022-08-30 25429f085093d89d543a0b90e30d0d62d1b7dac9
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;