| | |
| | | this.memberInfo = info;
|
| | |
|
| | | //设置标题信息
|
| | | string title = string.IsNullOrEmpty(info.UserName) == true ? info.Account : info.UserName;
|
| | | base.SetTitleText(title);
|
| | | base.SetTitleText(info.ShowName);
|
| | |
|
| | | //初始化右上角的图标
|
| | | this.InitTopRightIcon();
|
| | |
| | | /// </summary>
|
| | | private void InitTopRightIcon()
|
| | | {
|
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1)
|
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | //确定授权「{0}」成为管理员?
|
| | | msg = Language.StringByID(R.MyInternationalizationString.uUpSubAccountLevel);
|
| | | }
|
| | | msg = msg.Replace("{0}", string.IsNullOrEmpty(memberInfo.UserName) == true ? memberInfo.Account : memberInfo.UserName);
|
| | | msg = msg.Replace("{0}", memberInfo.ShowName);
|
| | |
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, () =>
|
| | | {
|
| | |
| | | bodyFrameLayout.AddChidren(frame);
|
| | |
|
| | | //用户图标
|
| | | string iconPath = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, memberInfo.DistributedMark + ".png");
|
| | | string iconPath = System.IO.Path.Combine(HdlFileNameResourse.UserPictrueDirectory, memberInfo.ChildAccountId + ".png");
|
| | | var btnUserIcon = new ImageView();
|
| | | btnUserIcon.Height = this.GetPictrueRealSize(207);
|
| | | btnUserIcon.Width = this.GetPictrueRealSize(207);
|
| | |
| | | {
|
| | | //标题:成员权限
|
| | | var btnMenberTile = new NormalViewControl(800, 60, true);
|
| | | btnMenberTile.X = ControlCommonResourse.XXLeft;
|
| | | btnMenberTile.X = HdlControlResourse.XXLeft;
|
| | | btnMenberTile.Y = Application.GetRealHeight(418);
|
| | | btnMenberTile.TextColor = UserCenterColor.Current.TextColor2;
|
| | | btnMenberTile.TextID = R.MyInternationalizationString.MenberAuthority;
|
| | |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uConfirmRemoveMember);
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, () =>
|
| | | {
|
| | | //删除子账号
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | this.DeleteSubAccount();
|
| | | });
|
| | | });
|
| | | };
|
| | | }
|
| | |
| | |
|
| | | //开关
|
| | | var btnSwitch = row.AddMostRightSwitchIcon();
|
| | | if (this.memberInfo.IsAllowRemoteCtrl == true)
|
| | | if (this.memberInfo.IsRemoteControl == true)
|
| | | {
|
| | | btnSwitch.IsSelected = true;
|
| | | }
|
| | | btnSwitch.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | btnSwitch.CanClick = false;
|
| | | bool statu = !btnSwitch.IsSelected;
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | var pra = new
|
| | | {
|
| | | HouseDistributedMark = Common.Config.Instance.Home.Id,
|
| | | DistributedMark = this.memberInfo.DistributedMark,
|
| | | IsAllowRemoteCtrl = !btnSwitch.IsSelected
|
| | | };
|
| | | //打开进度条
|
| | | this.ShowProgressBar();
|
| | | var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ChangeSubAccountIsAllowRemoteCtrl", false, pra);
|
| | | var result = HdlMemberLogic.Current.SetRemoteOperationPermissions(this.memberInfo.ChildAccountId, statu);
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | |
|
| | |
| | | {
|
| | | return;
|
| | | }
|
| | | this.memberInfo.IsAllowRemoteCtrl = !btnSwitch.IsSelected;
|
| | | this.memberInfo.IsRemoteControl = statu;
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | btnSwitch.IsSelected = statu;
|
| | | btnSwitch.CanClick = true;
|
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected;
|
| | | });
|
| | | });
|
| | |
|
| | |
| | | //右图标
|
| | | row.AddRightArrow();
|
| | |
|
| | | var memberShardInfo = new MemberShardInfoData();
|
| | | row.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new SharedContent.LookSharedListRoomForm();
|
| | | form.AddForm(memberInfo, memberShardInfo);
|
| | | form.AddForm(memberInfo.ChildAccountId);
|
| | | };
|
| | | }
|
| | |
|
| | |
| | | /// <summary>
|
| | | /// 升级或者降级子账号
|
| | | /// </summary>
|
| | | public void UpOrDownSubAccountLevel()
|
| | | private void UpOrDownSubAccountLevel()
|
| | | {
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | | var pra = new UpOrDownLevelPra();
|
| | | pra.DistributedMark = memberInfo.DistributedMark;
|
| | |
|
| | | bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpSubAccount", false, pra);
|
| | | //变更权限
|
| | | var result = HdlMemberLogic.Current.EditorMemberAuthority(this.memberInfo.ChildAccountId, memberInfo.AccountType == 1 ? 1 : 3);
|
| | | if (result == false)
|
| | | {
|
| | | this.CloseProgressBar();
|
| | | return;
|
| | | }
|
| | | this.CloseProgressBar();
|
| | |
|
| | | //变更权限
|
| | | memberInfo.AccountType = memberInfo.AccountType == 1 ? 0 : 1;
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (this.Parent == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //变更权限图标
|
| | | if (memberInfo.AccountType == 1)
|
| | | {
|
| | |
| | | //打开显示成功的画面
|
| | | var form = new SubAccountLevelUpSuccessForm();
|
| | | form.AddForm(memberInfo);
|
| | | });
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | /// </summary>
|
| | | private void DeleteSubAccount()
|
| | | {
|
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | | var pra = new DeleteSubAccountPra();
|
| | | pra.SubAccount = memberInfo.SubAccountDistributedMark;
|
| | |
|
| | | bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/DeletedSubAccount", false, pra);
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | |
|
| | | bool result = HdlMemberLogic.Current.DeleteMember(this.memberInfo.ChildAccountId);
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //从成员一览画面移除
|
| | | this.LoadFormMethodByName("MemberListForm", "DeleteRowByAccount", memberInfo.Account);
|
| | | //自身关闭
|
| | | this.CloseForm();
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | {
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | var pra = new AccountInfoPra();
|
| | | pra.Account = memberInfo.Account;
|
| | | var result = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string> { "NotCheck" }, false);
|
| | | 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)
|
| | | var imageData = HdlAccountLogic.Current.DownLoadAccountPictrue(memberInfo.Account);
|
| | | if (imageData != null && imageData.Length > 0)
|
| | | {
|
| | | //写入头像内容
|
| | | string iconPath = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, memberInfo.DistributedMark + ".png");
|
| | | Shared.IO.FileUtils.WriteFileByBytes(iconPath, infoResult.HeadImage);
|
| | | string iconPath = System.IO.Path.Combine(HdlFileNameResourse.UserPictrueDirectory, memberInfo.ChildAccountId + ".png");
|
| | | Shared.IO.FileUtils.WriteFileByBytes(iconPath, imageData);
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | btnUserIcon.ImageBytes = Shared.IO.FileUtils.ReadFile(iconPath);
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 结构体_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 升级或者降级子账号的启动参数
|
| | | /// </summary>
|
| | | private class UpOrDownLevelPra : IfacePraCommon
|
| | | {
|
| | | /// <summary>
|
| | | /// 通过《住宅的Guid查询住宅下面的子账号》接口时,返回的DistributedMark字段
|
| | | /// </summary>
|
| | | public string DistributedMark = string.Empty;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 删除子账号的启动参数
|
| | | /// </summary>
|
| | | private class DeleteSubAccountPra : IfacePraCommon
|
| | | {
|
| | | /// <summary>
|
| | | /// 通过《住宅的Guid查询住宅下面的子账号》接口时,返回的DistributedMark字段
|
| | | /// </summary>
|
| | | public string SubAccount = string.Empty;
|
| | | /// <summary>
|
| | | /// HouseDistributedMark
|
| | | /// </summary>
|
| | | public string HouseDistributedMark = Common.Config.Instance.HomeId;
|
| | | }
|
| | | #endregion
|
| | | }
|
| | | }
|