| | |
| | | /// <summary>
|
| | | /// 成员信息
|
| | | /// </summary>
|
| | | private AccountInfoResult memberResult = null;
|
| | | private AccountInfoResult AccountResult = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | |
| | | /// <param name="i_infoResult">成员信息</param>
|
| | | public void ShowForm(AccountInfoResult i_infoResult)
|
| | | {
|
| | | this.memberResult = i_infoResult;
|
| | | this.AccountResult = i_infoResult;
|
| | |
|
| | | //设置标题信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uMemberInformation));
|
| | |
| | | btnUserIcon.Height = this.GetPictrueRealSize(207);
|
| | | btnUserIcon.Width = this.GetPictrueRealSize(207);
|
| | | btnUserIcon.Radius = (uint)this.GetPictrueRealSize(207) / 2;
|
| | | if (memberResult.HeadImage != null)
|
| | | if (AccountResult.HeadImage != null)
|
| | | {
|
| | | btnUserIcon.ImageBytes = memberResult.HeadImage;
|
| | | btnUserIcon.ImageBytes = AccountResult.HeadImage;
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | btnUserId.IsBold = true;
|
| | | btnUserId.Y = Application.GetRealHeight(472);
|
| | | btnUserId.Gravity = Gravity.CenterHorizontal;
|
| | | btnUserId.Text = memberResult.Account;
|
| | | btnUserId.Text = AccountResult.Account;
|
| | | btnUserId.TextAlignment = TextAlignment.Center;
|
| | | btnUserId.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | bodyFrameLayout.AddChidren(btnUserId);
|
| | |
| | | btnName.Gravity = Gravity.CenterHorizontal;
|
| | | btnName.TextAlignment = TextAlignment.Center;
|
| | | btnName.TextSize = 16;
|
| | | //如果它本身就没名字的话,把他的ID作为昵称
|
| | | btnName.Text = string.IsNullOrEmpty(memberResult.UserName) == true ? memberResult.Account : memberResult.UserName;
|
| | | btnName.Text = AccountResult.MemberName;
|
| | | bodyFrameLayout.AddChidren(btnName);
|
| | |
|
| | | //请确认账号是否正确{0}如正确请点击确认
|
| | |
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | | var pra = new BindSubAccountPra();
|
| | | pra.SubAccount = memberResult.Account;
|
| | |
|
| | | bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/BindSubAccount", false, pra);
|
| | | if (result == false)
|
| | | //添加成员
|
| | | var memberInfoRes = HdlMemberLogic.Current.AddMember(AccountResult.Account, AccountResult.MemberName);
|
| | | if (memberInfoRes == null)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | return;
|
| | | }
|
| | |
|
| | | //获取这个成员的SubDistributedMark
|
| | | var pra2 = new MemberListInfoPra();
|
| | | string resultValue = UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra2);
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | |
|
| | | if (string.IsNullOrEmpty(resultValue) == true)
|
| | | //添加子账号时,接口并不返回这些东西,所以需要手动赋值
|
| | | memberInfoRes.ChildNickName = AccountResult.MemberName;
|
| | | if (AccountResult.Account.Contains("@") == true)
|
| | | {
|
| | | return;
|
| | | memberInfoRes.ChildAccountEmail = AccountResult.Account;
|
| | | }
|
| | | List<MemberInfoRes> listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MemberInfoRes>>(resultValue);
|
| | | MemberInfoRes memberInfoRes = null;
|
| | | foreach (var info in listInfo)
|
| | | else
|
| | | {
|
| | | //当账号绑定了邮箱时,它返回的是邮箱账号
|
| | | if (info.Account == memberResult.Account
|
| | | || info.Account == memberResult.Email)
|
| | | {
|
| | | memberInfoRes = info;
|
| | | break;
|
| | | }
|
| | | }
|
| | | if (memberInfoRes == null)
|
| | | {
|
| | | //出现意外情况,数据丢失
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uUnKnownErrorAndLostData);
|
| | | this.ShowMassage(ShowMsgType.Tip, msg);
|
| | | return;
|
| | | memberInfoRes.ChildAccountPhone = AccountResult.Account;
|
| | | }
|
| | |
|
| | | string iconPath = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, memberInfoRes.DistributedMark + ".png");
|
| | | if (memberResult.HeadImage != null)
|
| | | string iconPath = System.IO.Path.Combine(HdlFileNameResourse.UserPictrueDirectory, memberInfoRes.ChildAccountId + ".png");
|
| | | if (AccountResult.HeadImage != null)
|
| | | {
|
| | | //写入头像内容
|
| | | Shared.IO.FileUtils.WriteFileByBytes(iconPath, memberResult.HeadImage);
|
| | | Shared.IO.FileUtils.WriteFileByBytes(iconPath, AccountResult.HeadImage);
|
| | | }
|
| | |
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //成员添加成功
|
| | | var form = new AddMemberSuccessForm();
|
| | | form.AddForm(memberInfoRes, memberInfoRes.DistributedMark);
|
| | | form.AddForm(memberInfoRes);
|
| | | form.FormCloseEvent += (() =>
|
| | | {
|
| | | this.CloseForm();
|
| | | //关闭手动输入成员ID的画面
|
| | | this.CloseFormByFormName("AddMemberByIdForm");
|
| | | HdlFormLogic.Current.CloseFormByFormName("AddMemberByIdForm");
|
| | | //添加成员
|
| | | this.LoadFormMethodByName("MemberListForm", "AddRowLayoutByOtherForm", memberInfoRes);
|
| | | });
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 结构体_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 绑定成员ID到住宅的启动参数
|
| | | /// </summary>
|
| | | private class BindSubAccountPra : IfacePraCommon
|
| | | {
|
| | | /// <summary>
|
| | | /// 子账号ID
|
| | | /// </summary>
|
| | | public string SubAccount = string.Empty;
|
| | | /// <summary>
|
| | | /// 住宅ID
|
| | | /// </summary>
|
| | | public string HouseDistributedMark = Common.Config.Instance.Home.Id;
|
| | | }
|
| | | #endregion
|
| | | }
|
| | | }
|