黄学彪
2019-11-13 8b9ce384b26c414db32f98e94e088f5334869c2d
ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs
@@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
namespace Shared.Phone.UserCenter.Member
{
    /// <summary>
@@ -112,11 +114,24 @@
            bodyFrameLayout.AddChidren(frame);
            //用户图标
            var btnUserIcon = new PicViewControl(207, 207);
            string iconPath = System.IO.Path.Combine(UserCenterResourse.Option.UserPictruePath, memberInfo.DistributedMark + ".png");
            var btnUserIcon = new ImageView();
            btnUserIcon.Height = Application.GetMinRealAverage(207);
            btnUserIcon.Width = Application.GetMinRealAverage(207);
            btnUserIcon.Radius = (uint)Application.GetMinRealAverage(207) / 2;
            if (System.IO.File.Exists(iconPath) == true)
            {
                btnUserIcon.ImagePath = iconPath;
            }
            else
            {
                btnUserIcon.ImagePath = "Center/Admin.png";
            }
            btnUserIcon.Y = Application.GetRealHeight(45);
            btnUserIcon.Gravity = Gravity.CenterHorizontal;
            btnUserIcon.UnSelectedImagePath = "Center/Admin.png";
            frame.AddChidren(btnUserIcon);
            //获取成员头像
            this.GetMemberIcon(btnUserIcon);
            //权限
            btnAuthority = new NormalViewControl(800, 50, true);
@@ -361,6 +376,43 @@
        #endregion
        #region ■ 获取成员头像_______________________
        /// <summary>
        /// 获取成员头像
        /// </summary>
        private void GetMemberIcon(ImageView btnUserIcon)
        {
            HdlThreadLogic.Current.RunThread(async () =>
            {
                var pra = new AccountInfoPra();
                pra.Account = memberInfo.Account;
                var result = await UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string>() { "NotSetAgain" });
                if (result == null)
                {
                    return;
                }
                var revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.ResponsePack>(System.Text.Encoding.UTF8.GetString(result));
                if (revertObj == null || revertObj.ResponseData == null)
                {
                    return;
                }
                var infoResult = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountInfoResult>(revertObj.ResponseData.ToString());
                if (infoResult.HeadImage != null)
                {
                    //写入头像内容
                    string iconPath = System.IO.Path.Combine(UserCenterResourse.Option.UserPictruePath, memberInfo.DistributedMark + ".png");
                    Shared.IO.FileUtils.WriteFileByBytes(iconPath, infoResult.HeadImage);
                    HdlThreadLogic.Current.RunMain(() =>
                    {
                        btnUserIcon.ImagePath = iconPath;
                    });
                }
            });
        }
        #endregion
        #region ■ 结构体_____________________________
        /// <summary>