HDL Home App 第二版本 旧平台金堂用 正在使用
chenqiyang
2022-06-22 dc0309e64f02227d8e1468b7326c07955f804612
ZigbeeApp/Shared/Phone/UserCenter/Member/MemberManagementForm.cs
@@ -114,11 +114,11 @@
            bodyFrameLayout.AddChidren(frame);
            //用户图标
            string iconPath = System.IO.Path.Combine(UserCenterResourse.Option.UserPictruePath, memberInfo.DistributedMark + ".png");
            string iconPath = System.IO.Path.Combine(UserCenterResourse.AccountOption.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;
            btnUserIcon.Height = this.GetPictrueRealSize(207);
            btnUserIcon.Width = this.GetPictrueRealSize(207);
            btnUserIcon.Radius = (uint)this.GetPictrueRealSize(207) / 2;
            if (System.IO.File.Exists(iconPath) == true)
            {
                btnUserIcon.ImageBytes = Shared.IO.FileUtils.ReadFile(iconPath);
@@ -139,7 +139,7 @@
            btnAuthority.TextSize = 12;
            btnAuthority.Y = btnUserIcon.Bottom + Application.GetRealHeight(23);
            btnAuthority.Gravity = Gravity.CenterHorizontal;
            btnAuthority.TextColor = UserCenterColor.Current.TextGrayColor;
            btnAuthority.TextColor = UserCenterColor.Current.TextGrayColor1;
            btnAuthority.TextID = R.MyInternationalizationString.uMember;
            if (memberInfo.AccountType == 1)
            {
@@ -159,7 +159,7 @@
        private void InitInfoList()
        {
            //标题:成员权限
            var btnMenberTile = new DetailTitleControl(800, 60, true);
            var btnMenberTile = new NormalViewControl(800, 60, true);
            btnMenberTile.X = ControlCommonResourse.XXLeft;
            btnMenberTile.Y = Application.GetRealHeight(418);
            btnMenberTile.TextColor = UserCenterColor.Current.TextColor2;
@@ -191,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;
@@ -203,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);
@@ -219,7 +219,10 @@
                this.ShowMassage(ShowMsgType.Confirm, msg, () =>
                {
                    //删除子账号
                    this.DeleteSubAccount();
                    HdlThreadLogic.Current.RunThread(() =>
                    {
                        this.DeleteSubAccount();
                    });
                });
            };
        }
@@ -251,7 +254,8 @@
            }
            btnSwitch.ButtonClickEvent += (sender, e) =>
            {
                HdlThreadLogic.Current.RunThread(async () =>
                btnSwitch.CanClick = false;
                HdlThreadLogic.Current.RunThread(() =>
                {
                    var pra = new
                    {
@@ -261,7 +265,7 @@
                    };
                    //打开进度条
                    this.ShowProgressBar();
                    var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ChangeSubAccountIsAllowRemoteCtrl", false, pra);
                    var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ChangeSubAccountIsAllowRemoteCtrl", false, pra);
                    //关闭进度条
                    this.CloseProgressBar();
@@ -271,8 +275,9 @@
                    }
                    this.memberInfo.IsAllowRemoteCtrl = !btnSwitch.IsSelected;
                    Application.RunOnMainThread(() =>
                    HdlThreadLogic.Current.RunMain(() =>
                    {
                        btnSwitch.CanClick = true;
                        btnSwitch.IsSelected = !btnSwitch.IsSelected;
                    });
                });
@@ -319,46 +324,49 @@
        /// <summary>
        /// 升级或者降级子账号
        /// </summary>
        public async void UpOrDownSubAccountLevel()
        public void UpOrDownSubAccountLevel()
        {
            //开启进度条
            this.ShowProgressBar();
            var pra = new UpOrDownLevelPra();
            pra.DistributedMark = memberInfo.DistributedMark;
            bool result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpSubAccount", false, pra);
            if (result == false)
            HdlThreadLogic.Current.RunThread(() =>
            {
                this.CloseProgressBar();
                return;
            }
            this.CloseProgressBar();
                //开启进度条
                this.ShowProgressBar();
            //变更权限
            memberInfo.AccountType = memberInfo.AccountType == 1 ? 0 : 1;
                var pra = new UpOrDownLevelPra();
                pra.DistributedMark = memberInfo.DistributedMark;
            Application.RunOnMainThread(() =>
            {
                if (this.Parent == null)
                bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpSubAccount", false, pra);
                if (result == false)
                {
                    this.CloseProgressBar();
                    return;
                }
                //变更权限图标
                if (memberInfo.AccountType == 1)
                {
                    btnTopIcon.UnSelectedImagePath = "Item/HadAuthority.png";
                }
                else
                {
                    btnTopIcon.UnSelectedImagePath = "Item/NotAuthority.png";
                }
                //变更权限文字
                btnAuthority.TextID = memberInfo.AccountType == 1 ? R.MyInternationalizationString.uMemberHadActionAuthority : R.MyInternationalizationString.uMember;
                this.CloseProgressBar();
                //打开显示成功的画面
                var form = new SubAccountLevelUpSuccessForm();
                form.AddForm(memberInfo);
                //变更权限
                memberInfo.AccountType = memberInfo.AccountType == 1 ? 0 : 1;
                HdlThreadLogic.Current.RunMain(() =>
                {
                    if (this.Parent == null)
                    {
                        return;
                    }
                    //变更权限图标
                    if (memberInfo.AccountType == 1)
                    {
                        btnTopIcon.UnSelectedImagePath = "Item/HadAuthority.png";
                    }
                    else
                    {
                        btnTopIcon.UnSelectedImagePath = "Item/NotAuthority.png";
                    }
                    //变更权限文字
                    btnAuthority.TextID = memberInfo.AccountType == 1 ? R.MyInternationalizationString.uMemberHadActionAuthority : R.MyInternationalizationString.uMember;
                    //打开显示成功的画面
                    var form = new SubAccountLevelUpSuccessForm();
                    form.AddForm(memberInfo);
                });
            });
        }
@@ -369,7 +377,7 @@
        /// <summary>
        /// 删除子账号
        /// </summary>
        private async void DeleteSubAccount()
        private void DeleteSubAccount()
        {
            //开启进度条
            this.ShowProgressBar();
@@ -377,7 +385,7 @@
            var pra = new DeleteSubAccountPra();
            pra.SubAccount = memberInfo.SubAccountDistributedMark;
            bool result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/DeletedSubAccount", false, pra);
            bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/DeletedSubAccount", false, pra);
            //关闭进度条
            this.CloseProgressBar();
@@ -386,21 +394,13 @@
                return;
            }
            //移除缓存
            UserCenterResourse.ListMemberInfo.RemoveAll((obj) =>
            HdlThreadLogic.Current.RunMain(() =>
            {
                if (obj.SubAccountDistributedMark == memberInfo.SubAccountDistributedMark)
                {
                    return true;
                }
                return false;
                //从成员一览画面移除
                this.LoadFormMethodByName("MemberListForm", "DeleteRowByAccount", memberInfo.Account);
                //自身关闭
                this.CloseForm();
            });
            UserCenterLogic.SaveLocalMemberListInfo();
            //从成员一览画面移除
            this.LoadFormMethodByName("MemberListForm", "DeleteRowByAccount", memberInfo.Account);
            //自身关闭
            this.CloseForm();
        }
        #endregion
@@ -412,11 +412,11 @@
        /// </summary>
        private void GetMemberIcon(ImageView btnUserIcon)
        {
            HdlThreadLogic.Current.RunThread(async () =>
            HdlThreadLogic.Current.RunThread(() =>
            {
                var pra = new AccountInfoPra();
                pra.Account = memberInfo.Account;
                var result = await UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string>() { "NotSetAgain" });
                var result = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string> { "NotCheck" }, false);
                if (result == null)
                {
                    return;
@@ -430,7 +430,7 @@
                if (infoResult.HeadImage != null)
                {
                    //写入头像内容
                    string iconPath = System.IO.Path.Combine(UserCenterResourse.Option.UserPictruePath, memberInfo.DistributedMark + ".png");
                    string iconPath = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, memberInfo.DistributedMark + ".png");
                    Shared.IO.FileUtils.WriteFileByBytes(iconPath, infoResult.HeadImage);
                    HdlThreadLogic.Current.RunMain(() =>
                    {