gxc
2020-02-28 66a9965c44ecc32a6696abca876ab9d1cd091584
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.ImageBytes = Shared.IO.FileUtils.ReadFile(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);
@@ -176,9 +191,9 @@
            this.AddShardContentRow(rowShard);
            //一旦移除该家庭成员,他/她将无法使用该网关下所绑定的设备
            var btnNote1 = new NormalViewControl(613, 98, true);
            btnNote1.X = Application.GetRealWidth(246);
            btnNote1.Y = Application.GetRealHeight(1328);
            var btnNote1 = new NormalViewControl(613, 100, true);
            btnNote1.X = Application.GetRealWidth(248);
            btnNote1.Y = Application.GetRealHeight(1327);
            btnNote1.TextSize = 12;
            btnNote1.TextID = R.MyInternationalizationString.RemoveMenberAndDonotUserBindGatewayDevice;
            btnNote1.IsMoreLines = true;
@@ -188,7 +203,7 @@
            var btnIcon = new IconViewControl(58);
            btnIcon.X = Application.GetRealWidth(167);
            btnIcon.Y = Application.GetRealHeight(1328);
            btnIcon.Y = btnNote1.Y;
            btnIcon.UnSelectedImagePath = "Item/Tips.png";
            bodyFrameLayout.AddChidren(btnIcon);
@@ -230,9 +245,38 @@
            //开关
            var btnSwitch = row.AddMostRightSwitchIcon();
            if (this.memberInfo.IsAllowRemoteCtrl == true)
            {
                btnSwitch.IsSelected = true;
            }
            btnSwitch.ButtonClickEvent += (sender, e) =>
            {
                btnSwitch.IsSelected = !btnSwitch.IsSelected;
                HdlThreadLogic.Current.RunThread(async () =>
                {
                    var pra = new
                    {
                        HouseDistributedMark = Common.Config.Instance.Home.Id,
                        DistributedMark = this.memberInfo.DistributedMark,
                        IsAllowRemoteCtrl = !btnSwitch.IsSelected
                    };
                    //打开进度条
                    this.ShowProgressBar();
                    var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ChangeSubAccountIsAllowRemoteCtrl", false, pra);
                    //关闭进度条
                    this.CloseProgressBar();
                    if (result == false)
                    {
                        return;
                    }
                    this.memberInfo.IsAllowRemoteCtrl = !btnSwitch.IsSelected;
                    Application.RunOnMainThread(() =>
                    {
                        btnSwitch.IsSelected = !btnSwitch.IsSelected;
                    });
                });
            };
            //底线
            row.AddBottomLine();
@@ -361,6 +405,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.ImageBytes = Shared.IO.FileUtils.ReadFile(iconPath);
                    });
                }
            });
        }
        #endregion
        #region ■ 结构体_____________________________
        /// <summary>