| | |
| | | btnName.Gravity = Gravity.CenterHorizontal;
|
| | | btnName.TextAlignment = TextAlignment.Center;
|
| | | btnName.TextSize = 16;
|
| | | btnName.Text = memberResult.MemberName;
|
| | | //如果它本身就没名字的话,把他的ID作为昵称
|
| | | btnName.Text = string.IsNullOrEmpty(memberResult.UserName) == true ? memberResult.Account : memberResult.UserName;
|
| | | bodyFrameLayout.AddChidren(btnName);
|
| | |
|
| | | //请确认账号是否正确{0}如正确请点击确认
|
| | |
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | | //添加成员
|
| | | var memberInfoRes = HdlMemberLogic.Current.AddMember(memberResult.Account, memberResult.MemberName);
|
| | | if (memberInfoRes == null)
|
| | | var pra = new BindSubAccountPra();
|
| | | pra.SubAccount = memberResult.Account;
|
| | |
|
| | | bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/BindSubAccount", false, pra);
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | return;
|
| | | }
|
| | | //添加子账号时,接口并不返回这些东西,所以需要手动赋值
|
| | | memberInfoRes.ChildNickName = memberResult.MemberName;
|
| | | if (memberResult.Account.Contains("@") == true)
|
| | |
|
| | | //获取这个成员的SubDistributedMark
|
| | | var pra2 = new MemberListInfoPra();
|
| | | string resultValue = UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra2);
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | |
|
| | | if (string.IsNullOrEmpty(resultValue) == true)
|
| | | {
|
| | | memberInfoRes.ChildAccountEmail = memberResult.Account;
|
| | | return;
|
| | | }
|
| | | else
|
| | | List<MemberInfoRes> listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MemberInfoRes>>(resultValue);
|
| | | MemberInfoRes memberInfoRes = null;
|
| | | foreach (var info in listInfo)
|
| | | {
|
| | | memberInfoRes.ChildAccountPhone = memberResult.Account;
|
| | | //当账号绑定了邮箱时,它返回的是邮箱账号
|
| | | 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;
|
| | | }
|
| | |
|
| | | string iconPath = System.IO.Path.Combine(HdlFileNameResourse.UserPictrueDirectory, memberInfoRes.ChildAccountId + ".png");
|
| | | string iconPath = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, memberInfoRes.DistributedMark + ".png");
|
| | | if (memberResult.HeadImage != null)
|
| | | {
|
| | | //写入头像内容
|
| | |
| | | {
|
| | | //成员添加成功
|
| | | var form = new AddMemberSuccessForm();
|
| | | form.AddForm(memberResult);
|
| | | form.AddForm(memberInfoRes, memberInfoRes.DistributedMark);
|
| | | form.FormCloseEvent += (() =>
|
| | | {
|
| | | this.CloseForm();
|
| | | //关闭手动输入成员ID的画面
|
| | | HdlFormLogic.Current.CloseFormByFormName("AddMemberByIdForm");
|
| | | this.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
|
| | | }
|
| | | }
|