| | |
| | | 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);
|
| | | };
|
| | | }
|
| | |
|
| | |
| | |
|
| | | //退出登陆
|
| | | var btnLogout = new NormalClickButton(specialFrame.Width, specialFrame.Height);
|
| | | btnLogout.clickStatuColor = 0xfffbfbfb;
|
| | | btnLogout.TextID = R.MyInternationalizationString.uLogoutAccount;
|
| | | btnLogout.TextColor = 0xff666666;
|
| | | btnLogout.BackgroundColor = UserCenterColor.Current.White;
|
| | |
| | |
|
| | | #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>
|