From 0d9f64668fd7350d6a21fd157e32009a96d98134 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 16 十二月 2020 13:09:08 +0800
Subject: [PATCH] 新云端代码Ver1.2

---
 ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs |   71 +++++++++++++++++------------------
 1 files changed, 34 insertions(+), 37 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs
index faa609b..bdb24b3 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs
@@ -21,7 +21,7 @@
         public void ShowForm()
         {
             //璁颁綇瀹冨師鏉ョ殑鏄电О
-            UserCenterResourse.UserInfo.OldUserName = UserCenterResourse.UserInfo.UserName;
+            HdlUserCenterResourse.UserInfo.OldUserName = HdlUserCenterResourse.UserInfo.NickName;
 
             //鍥犱负鍒殑鐢婚潰浼氳皟鐢ㄨ繖涓嚱鏁帮紝鐒跺悗鍒锋柊鐢婚潰
             this.ClearBodyFrame();
@@ -60,7 +60,7 @@
             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);
+            btnUserIcon.ImageBytes = Shared.IO.FileUtils.ReadFile(HdlFileNameResourse.UserHeadIconFile);
             specialTopFrame.AddChidren(btnUserIcon);
             btnUserIcon.MouseUpEventHandler += (sender, e) =>
             {
@@ -82,7 +82,7 @@
             {
                 frameMiddleBack = new NormalFrameLayout();
                 frameMiddleBack.Y = Application.GetRealHeight(363);
-                frameMiddleBack.Height = Application.GetRealHeight(1008) - ControlCommonResourse.ListViewRowHeight - Application.GetRealHeight(12);
+                frameMiddleBack.Height = Application.GetRealHeight(1008) - HdlControlResourse.ListViewRowHeight - Application.GetRealHeight(12);
                 frameMiddleBack.BackgroundColor = UserCenterColor.Current.White;
                 bodyFrameLayout.AddChidren(frameMiddleBack);
             }
@@ -108,10 +108,10 @@
             var txtName = new TextInputControl(700, true);
             txtName.MaxByte = 36;//闄愬埗36涓瓧鑺�
             txtName.UseFocusColor = true;
-            txtName.X = bodyFrameLayout.Width - Application.GetRealWidth(700) - ControlCommonResourse.XXLeft;
+            txtName.X = bodyFrameLayout.Width - Application.GetRealWidth(700) - HdlControlResourse.XXLeft;
             txtName.Gravity = Gravity.CenterVertical;
             txtName.TextAlignment = TextAlignment.CenterRight;
-            txtName.Text = UserCenterResourse.UserInfo.UserName;
+            txtName.Text = HdlUserCenterResourse.UserInfo.NickName;
             rowName.AddChidren(txtName, ChidrenBindMode.NotBind);
             txtName.Y += listMidFrame.rowSpace / 2;
             //杈撳叆缁撴潫浜嬩欢
@@ -124,7 +124,7 @@
             //鎵�浠ユ墠鍑烘涓嬬瓥,娣诲姞杩欎釜浜嬩欢)
             txtName.TextChangedEvent += (value) =>
             {
-                UserCenterResourse.UserInfo.UserName = value;
+                HdlUserCenterResourse.UserInfo.NickName = value;
             };
             //鍏夋爣鏀瑰彉浜嬩欢(2020.04.05:浠ュ墠閮藉畾姝昏鎸夊洖杞﹂敭鎵嶆洿鏂�,鐜板湪鍙堣鍚嶅瓧娌℃湁鍚屾
             //鎵�浠ユ墠鍑烘涓嬬瓥,娣诲姞杩欎釜浜嬩欢)
@@ -164,15 +164,15 @@
             //娣诲姞鍚戝彸鍥炬爣
             rowEmail.AddRightArrow();
             //閭
-            var btnEmail = rowEmail.AddMostRightView(UserCenterResourse.UserInfo.Email, 500);
-            if (string.IsNullOrEmpty(UserCenterResourse.UserInfo.Email) == true)
+            var btnEmail = rowEmail.AddMostRightView(HdlUserCenterResourse.UserInfo.UserEmail, 500);
+            if (string.IsNullOrEmpty(HdlUserCenterResourse.UserInfo.UserEmail) == true)
             {
                 //鏈缃�,璇风粦瀹�
                 btnEmail.TextID = R.MyInternationalizationString.uNotSettionAndPleaseBind;
             }
             rowEmail.ButtonClickEvent += (sender, e) =>
             {
-                if (string.IsNullOrEmpty(UserCenterResourse.UserInfo.Email) == true)
+                if (string.IsNullOrEmpty(HdlUserCenterResourse.UserInfo.UserEmail) == true)
                 {
                     var form = new Password.CheckNewEmailForm();
                     form.AddForm();
@@ -193,15 +193,15 @@
             //娣诲姞鍚戝彸鍥炬爣
             rowPhone.AddRightArrow();
             //鎵嬫満鍙�
-            var btnPhone = rowPhone.AddMostRightView(UserCenterResourse.UserInfo.Phone, 500);
-            if (string.IsNullOrEmpty(UserCenterResourse.UserInfo.Phone) == true)
+            var btnPhone = rowPhone.AddMostRightView(HdlUserCenterResourse.UserInfo.UserPhone, 500);
+            if (string.IsNullOrEmpty(HdlUserCenterResourse.UserInfo.UserPhone) == true)
             {
                 //鏈缃�,璇风粦瀹�
                 btnPhone.TextID = R.MyInternationalizationString.uNotSettionAndPleaseBind;
             }
             else
             {
-                string phoneNum = UserCenterResourse.UserInfo.Phone;
+                string phoneNum = HdlUserCenterResourse.UserInfo.UserPhone;
                 if (phoneNum.Length >= 11)
                 {
                     phoneNum = phoneNum.Substring(0, 3) + "".PadLeft(phoneNum.Length - 7, '*') + phoneNum.Substring(phoneNum.Length - 4, 4);
@@ -211,11 +211,11 @@
                     //鎴栬杩欐槸鍥藉鐨勬墜鏈哄惂
                     phoneNum = phoneNum.Substring(0, 3) + "".PadLeft(phoneNum.Length - 5, '*') + phoneNum.Substring(phoneNum.Length - 2, 2);
                 }
-                btnPhone.Text = "+" + UserCenterResourse.UserInfo.AreaCode + " " + phoneNum;
+                btnPhone.Text = "+" + HdlUserCenterResourse.UserInfo.PhoneAreaCode + " " + phoneNum;
             }
             rowPhone.ButtonClickEvent += (sender, e) =>
             {
-                if (string.IsNullOrEmpty(UserCenterResourse.UserInfo.Phone) == true)
+                if (string.IsNullOrEmpty(HdlUserCenterResourse.UserInfo.UserPhone) == true)
                 {
                     var form = new Password.CheckNewPhoneForm();
                     form.AddForm();
@@ -285,8 +285,8 @@
         private void InitLogoutFrameLayout()
         {
             var specialFrame = new FrameLayout();
-            specialFrame.Height = ControlCommonResourse.ListViewRowHeight;
-            specialFrame.Y = Application.GetRealHeight(1394) - ControlCommonResourse.ListViewRowHeight - Application.GetRealHeight(12);
+            specialFrame.Height = HdlControlResourse.ListViewRowHeight;
+            specialFrame.Y = Application.GetRealHeight(1394) - HdlControlResourse.ListViewRowHeight - Application.GetRealHeight(12);
             specialFrame.BackgroundColor = UserCenterColor.Current.White;
             bodyFrameLayout.AddChidren(specialFrame);
 
@@ -305,7 +305,7 @@
                 this.ShowMassage(ShowMsgType.Confirm, msg, () =>
                 {
                     //閫�鍑鸿处鍙�
-                    UserCenterLogic.ReLoginAgain(Common.Config.Instance.Account);
+                    HdlAccountLogic.Current.ReLoginAgain(Common.Config.Instance.Account);
                 });
             };
         }
@@ -320,22 +320,20 @@
         /// <param name="txtName"></param>
         private void SaveUserName(TextInputControl txtName, bool showMsg)
         {
-            if (UserCenterResourse.UserInfo.UserName == string.Empty)
+            if (HdlUserCenterResourse.UserInfo.NickName == string.Empty)
             {
                 //鎶婂悕绉拌繕鍘熷洖鍘�
-                txtName.Text = UserCenterResourse.UserInfo.OldUserName;
-                UserCenterResourse.UserInfo.UserName = UserCenterResourse.UserInfo.OldUserName;
+                txtName.Text = HdlUserCenterResourse.UserInfo.OldUserName;
+                HdlUserCenterResourse.UserInfo.NickName = HdlUserCenterResourse.UserInfo.OldUserName;
                 return;
             }
-            if (UserCenterResourse.UserInfo.OldUserName == UserCenterResourse.UserInfo.UserName)
+            if (HdlUserCenterResourse.UserInfo.OldUserName == HdlUserCenterResourse.UserInfo.NickName)
             {
                 //鏃犻渶淇敼
                 return;
             }
-            var pra = new SaveUserNamePra();
-            pra.UserName = UserCenterResourse.UserInfo.UserName;
 
-            bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpdateUserName", false, pra);
+            bool result = HdlAccountLogic.Current.EditorUserNikeName(HdlUserCenterResourse.UserInfo.NickName, showMsg == true ? ShowNetCodeMode.YES : ShowNetCodeMode.No);
             if (result == false)
             {
                 return;
@@ -348,7 +346,7 @@
                 this.ShowMassage(ShowMsgType.Tip, msg);
             }
 
-            UserCenterResourse.UserInfo.OldUserName = UserCenterResourse.UserInfo.UserName;
+            HdlUserCenterResourse.UserInfo.OldUserName = HdlUserCenterResourse.UserInfo.NickName;
         }
 
         #endregion
@@ -375,7 +373,7 @@
                         if (this.MoveUserIconFile(imagePath) == true)
                         {
                             //涓婁紶鐢ㄦ埛澶村儚鏂囦欢
-                            this.UpLoadUserIconFile(btnUser, UserCenterResourse.UserInfo.UserIconFile);
+                            this.UpLoadUserIconFile(btnUser, HdlFileNameResourse.UserHeadIconFile);
                         }
                     }
                 }, "HdlPicture");
@@ -392,7 +390,7 @@
                         if (this.MoveUserIconFile(imagePath) == true)
                         {
                             //涓婁紶鐢ㄦ埛澶村儚鏂囦欢
-                            this.UpLoadUserIconFile(btnUser, UserCenterResourse.UserInfo.UserIconFile);
+                            this.UpLoadUserIconFile(btnUser, HdlFileNameResourse.UserHeadIconFile);
                         }
                     }
                 }, "HdlPicture");
@@ -406,12 +404,16 @@
         /// <param name="imagePath"></param>
         private void UpLoadUserIconFile(ImageView btnUser, string imagePath)
         {
-            var pra = new { HeadImage = Shared.IO.FileUtils.ReadFile(imagePath) };
-            var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpdateHeadImage", false, pra);
+            var headImage = Shared.IO.FileUtils.ReadFile(imagePath);
+            if (headImage == null)
+            {
+                return;
+            }
+            var result = HdlAccountLogic.Current.UpLoadUserIconImage(headImage);
             if (result == true)
             {
-                UserCenterResourse.UserInfo.UserIconFileChanged = true;
-                btnUser.ImageBytes = Shared.IO.FileUtils.ReadFile(imagePath);
+                HdlUserCenterResourse.UserInfo.UserIconFileChanged = true;
+                btnUser.ImageBytes = headImage;
             }
         }
 
@@ -424,12 +426,7 @@
         {
             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);
+                HdlFileLogic.Current.MoveFile(imagePath, HdlFileNameResourse.UserHeadIconFile);
                 return true;
             }
             catch (Exception ex)

--
Gitblit v1.8.0