From 7b60238359b94125d591678eff105ae2bf47843f Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 15 十一月 2019 13:16:21 +0800
Subject: [PATCH] 2019.11.15
---
ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs | 107 +++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 99 insertions(+), 8 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs
index d8d38b6..8b2940a 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs
@@ -46,20 +46,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;
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);
};
}
@@ -252,6 +250,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 +305,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.ImagePath = 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>
--
Gitblit v1.8.0