| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | |
|
| | | namespace Shared.Phone.UserCenter.Member
|
| | | {
|
| | | /// <summary>
|
| | |
| | | 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;
|
| | | }
|
| | |
| | | btnTopIcon = new MostRightIconControl(69, 69);
|
| | | if (memberInfo.AccountType == 1)
|
| | | {
|
| | | btnTopIcon.UnSelectedImagePath = "Account/HadAuthority.png";
|
| | | btnTopIcon.UnSelectedImagePath = "Item/HadAuthority.png";
|
| | | }
|
| | | else
|
| | | {
|
| | | btnTopIcon.UnSelectedImagePath = "Account/NotAuthority.png";
|
| | | btnTopIcon.UnSelectedImagePath = "Item/NotAuthority.png";
|
| | | }
|
| | | topFrameLayout.AddChidren(btnTopIcon);
|
| | | btnTopIcon.InitControl();
|
| | | btnTopIcon.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //确定取消「{0}」管理员权限?
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDownSubAccountLevel);
|
| | | if (memberInfo.AccountType != 1)
|
| | | {
|
| | | //确定授权「{0}」成为管理员?
|
| | | msg = Language.StringByID(R.MyInternationalizationString.uUpSubAccountLevel);
|
| | | }
|
| | | msg = msg.Replace("{0}", memberInfo.ShowName);
|
| | |
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, () =>
|
| | | {
|
| | | this.UpOrDownSubAccountLevel();
|
| | | //二次安全验证,如果没有设置有,直接跳过验证
|
| | | HdlCheckLogic.Current.CheckSecondarySecurity(
|
| | | () => { this.UpOrDownSubAccountLevel(); },
|
| | | () => { this.UpOrDownSubAccountLevel(); });
|
| | | });
|
| | | };
|
| | | }
|
| | |
| | | bodyFrameLayout.AddChidren(frame);
|
| | |
|
| | | //用户图标
|
| | | var btnUserIcon = new PicViewControl(207, 207);
|
| | | 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);
|
| | | btnUserIcon.Radius = (uint)this.GetPictrueRealSize(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);
|
| | |
| | | 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)
|
| | | {
|
| | |
| | | private void InitInfoList()
|
| | | {
|
| | | //标题:成员权限
|
| | | var btnMenberTile = new DetailTitleControl(800, 60, true);
|
| | | btnMenberTile.X = ControlCommonResourse.XXLeft;
|
| | | var btnMenberTile = new NormalViewControl(800, 60, true);
|
| | | btnMenberTile.X = HdlControlResourse.XXLeft;
|
| | | btnMenberTile.Y = Application.GetRealHeight(418);
|
| | | btnMenberTile.TextColor = UserCenterColor.Current.TextColor2;
|
| | | btnMenberTile.TextID = R.MyInternationalizationString.MenberAuthority;
|
| | |
| | | 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;
|
| | |
| | |
|
| | | 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);
|
| | |
|
| | |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uConfirmRemoveMember);
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, () =>
|
| | | {
|
| | | //删除子账号
|
| | | this.DeleteSubAccount();
|
| | | });
|
| | | };
|
| | |
| | | btnName.TextSize = 15;
|
| | |
|
| | | //开关
|
| | | var btnSwitch = row.AddMostRightEmptyIcon(104, 63);
|
| | | row.ChangedChidrenBindMode(btnSwitch, ChidrenBindMode.NotBind);
|
| | | btnSwitch.UnSelectedImagePath = "Item/Switch.png";
|
| | | btnSwitch.SelectedImagePath = "Item/SwitchSelected.png";
|
| | | var btnSwitch = row.AddMostRightSwitchIcon();
|
| | | if (this.memberInfo.IsRemoteControl == true)
|
| | | {
|
| | | btnSwitch.IsSelected = true;
|
| | | }
|
| | | btnSwitch.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected;
|
| | | btnSwitch.CanClick = false;
|
| | | bool statu = !btnSwitch.IsSelected;
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //打开进度条
|
| | | this.ShowProgressBar();
|
| | | var result = HdlMemberLogic.Current.SetRemoteOperationPermissions(this.memberInfo.ChildAccountId, statu);
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | |
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | | this.memberInfo.IsRemoteControl = statu;
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | btnSwitch.IsSelected = statu;
|
| | | btnSwitch.CanClick = true;
|
| | | });
|
| | | });
|
| | | |
| | | };
|
| | | //底线
|
| | | row.AddBottomLine();
|
| | |
| | | //右图标
|
| | | row.AddRightArrow();
|
| | |
|
| | | var memberShardInfo = new MemberShardInfoData();
|
| | | row.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new SharedContent.SearchConfigureSharedListRoomForm();
|
| | | form.AddForm(memberInfo, memberShardInfo);
|
| | | var form = new SharedContent.LookSharedListRoomForm();
|
| | | form.AddForm(memberInfo.ChildAccountId);
|
| | | };
|
| | | }
|
| | |
|
| | |
| | | /// <summary>
|
| | | /// 升级或者降级子账号
|
| | | /// </summary>
|
| | | public async void UpOrDownSubAccountLevel()
|
| | | private void UpOrDownSubAccountLevel()
|
| | | {
|
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | | var pra = new UpOrDownLevelPra();
|
| | | pra.DistributedMark = memberInfo.DistributedMark;
|
| | |
|
| | | bool result = await 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;
|
| | |
|
| | | Application.RunOnMainThread(() =>
|
| | | //变更权限图标
|
| | | if (memberInfo.AccountType == 1)
|
| | | {
|
| | | if (this.Parent == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //变更权限图标
|
| | | if (memberInfo.AccountType == 1)
|
| | | {
|
| | | btnTopIcon.UnSelectedImagePath = "Account/HadAuthority.png";
|
| | | }
|
| | | else
|
| | | {
|
| | | btnTopIcon.UnSelectedImagePath = "Account/NotAuthority.png";
|
| | | }
|
| | | //变更权限文字
|
| | | btnAuthority.TextID = memberInfo.AccountType == 1 ? R.MyInternationalizationString.uMemberHadActionAuthority : R.MyInternationalizationString.uMember;
|
| | | btnTopIcon.UnSelectedImagePath = "Item/HadAuthority.png";
|
| | | }
|
| | | else
|
| | | {
|
| | | btnTopIcon.UnSelectedImagePath = "Item/NotAuthority.png";
|
| | | }
|
| | | //变更权限文字
|
| | | btnAuthority.TextID = memberInfo.AccountType == 1 ? R.MyInternationalizationString.uMemberHadActionAuthority : R.MyInternationalizationString.uMember;
|
| | |
|
| | | //打开显示成功的画面
|
| | | if (memberInfo.AccountType == 1)
|
| | | {
|
| | | var form = new SubAccountLevelUpSuccessForm();
|
| | | form.AddForm(memberInfo);
|
| | | }
|
| | | });
|
| | | //打开显示成功的画面
|
| | | var form = new SubAccountLevelUpSuccessForm();
|
| | | form.AddForm(memberInfo);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | /// <summary>
|
| | | /// 删除子账号
|
| | | /// </summary>
|
| | | private async void DeleteSubAccount()
|
| | | private void DeleteSubAccount()
|
| | | {
|
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | | var pra = new DeleteSubAccountPra();
|
| | | pra.SubAccount = memberInfo.SubAccountDistributedMark;
|
| | |
|
| | | bool result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/DeletedSubAccount", false, pra);
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | |
|
| | | bool result = HdlMemberLogic.Current.DeleteMember(this.memberInfo.ChildAccountId);
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | //移除缓存
|
| | | UserCenterResourse.ListMemberInfo.RemoveAll((obj) =>
|
| | | {
|
| | | if (obj.SubAccountDistributedMark == memberInfo.SubAccountDistributedMark)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | | });
|
| | | UserCenterLogic.SaveLocalMemberListInfo();
|
| | |
|
| | | //从成员一览画面移除
|
| | | this.LoadFormMethodByName("MemberListForm", "DeleteRowByAccount", memberInfo.Account);
|
| | | //自身关闭
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 结构体_____________________________
|
| | | #region ■ 获取成员头像_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 升级或者降级子账号的启动参数
|
| | | /// 获取成员头像
|
| | | /// </summary>
|
| | | private class UpOrDownLevelPra : IfacePraCommon
|
| | | private void GetMemberIcon(ImageView btnUserIcon)
|
| | | {
|
| | | /// <summary>
|
| | | /// 通过《住宅的Guid查询住宅下面的子账号》接口时,返回的DistributedMark字段
|
| | | /// </summary>
|
| | | public string DistributedMark = string.Empty;
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | var imageData = HdlAccountLogic.Current.DownLoadAccountPictrue(memberInfo.Account);
|
| | | if (imageData != null && imageData.Length > 0)
|
| | | {
|
| | | //写入头像内容
|
| | | 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);
|
| | | });
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /// <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
|
| | | }
|
| | | }
|