| | |
| | | /// <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));
|
| | |
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | string iconPath = System.IO.Path.Combine(UserCenterResourse.Option.UserPictruePath, memberResult.DistributedMark + ".png");
|
| | | if (memberResult.HeadImage != null)
|
| | | {
|
| | | //写入头像内容
|
| | | Shared.IO.FileUtils.WriteFileByBytes(iconPath, memberResult.HeadImage);
|
| | | }
|
| | |
|
| | | //头像
|
| | | var btnUserIcon = new ImageView();
|
| | | btnUserIcon.Height = Application.GetMinRealAverage(207);
|
| | | btnUserIcon.Width = Application.GetMinRealAverage(207);
|
| | | btnUserIcon.Radius = (uint)Application.GetMinRealAverage(207) / 2;
|
| | | if (memberResult.HeadImage != null)
|
| | | btnUserIcon.Height = this.GetPictrueRealSize(207);
|
| | | btnUserIcon.Width = this.GetPictrueRealSize(207);
|
| | | btnUserIcon.Radius = (uint)this.GetPictrueRealSize(207) / 2;
|
| | | if (AccountResult.HeadImage != null)
|
| | | {
|
| | | btnUserIcon.ImageBytes = Shared.IO.FileUtils.ReadFile(iconPath);
|
| | | btnUserIcon.ImageBytes = AccountResult.HeadImage;
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | |
|
| | | //成员ID
|
| | | var btnUserId = new NormalViewControl(800, 50, true);
|
| | | 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);
|
| | |
|
| | | //昵称
|
| | | var btnName = new NormalViewControl(800, 55, true);
|
| | | btnName.IsBold = true;
|
| | | btnName.Y = Application.GetRealHeight(541);
|
| | | 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}如正确请点击确认
|
| | |
| | | strMsg = string.Format(strMsg, "\r\n");
|
| | | }
|
| | | var btnmsg = new NormalViewControl(800, 100, true);
|
| | | btnmsg.IsBold = true;
|
| | | btnmsg.Y = Application.GetRealHeight(913);
|
| | | btnmsg.TextSize = 12;
|
| | | btnmsg.Text = strMsg;
|
| | |
| | | btnOk.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //添加成员
|
| | | this.DoAddMember();
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | this.DoAddMember();
|
| | | });
|
| | | };
|
| | | }
|
| | |
|
| | |
| | | /// <summary>
|
| | | /// 添加成员
|
| | | /// </summary>
|
| | | private async void DoAddMember()
|
| | | private void DoAddMember()
|
| | | {
|
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | | var pra = new BindSubAccountPra();
|
| | | pra.SubAccount = memberResult.Account;
|
| | |
|
| | | bool result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/BindSubAccount", false, pra);
|
| | | if (result == false)
|
| | | //添加成员
|
| | | var memberInfoRes = HdlMemberLogic.Current.AddMember(AccountResult.Account, AccountResult.MemberName);
|
| | | if (memberInfoRes == null)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | return;
|
| | | }
|
| | | //添加子账号时,接口并不返回这些东西,所以需要手动赋值
|
| | | memberInfoRes.ChildNickName = AccountResult.MemberName;
|
| | | if (AccountResult.Account.Contains("@") == true)
|
| | | {
|
| | | memberInfoRes.ChildAccountEmail = AccountResult.Account;
|
| | | }
|
| | | else
|
| | | {
|
| | | memberInfoRes.ChildAccountPhone = AccountResult.Account;
|
| | | }
|
| | |
|
| | | //获取这个成员的SubDistributedMark
|
| | | var pra2 = new MemberListInfoPra();
|
| | | string resultValue = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra2);
|
| | | string iconPath = System.IO.Path.Combine(HdlFileNameResourse.UserPictrueDirectory, memberInfoRes.ChildAccountId + ".png");
|
| | | if (AccountResult.HeadImage != null)
|
| | | {
|
| | | //写入头像内容
|
| | | Shared.IO.FileUtils.WriteFileByBytes(iconPath, AccountResult.HeadImage);
|
| | | }
|
| | |
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | |
|
| | | if (resultValue == null)
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //出现未知错误,数据丢失
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uUnknownErrorAndDataLost);
|
| | | this.ShowMassage(ShowMsgType.Tip, msg);
|
| | | return;
|
| | | }
|
| | | List<MemberInfoRes> listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MemberInfoRes>>(resultValue);
|
| | | MemberInfoRes memberInfoRes = null;
|
| | | foreach (var info in listInfo)
|
| | | {
|
| | | if (info.Account == memberResult.Account)
|
| | | //成员添加成功
|
| | | var form = new AddMemberSuccessForm();
|
| | | form.AddForm(memberInfoRes);
|
| | | form.FormCloseEvent += (() =>
|
| | | {
|
| | | memberInfoRes = info;
|
| | | break;
|
| | | }
|
| | | }
|
| | | if (memberInfoRes == null)
|
| | | {
|
| | | //出现未知错误,数据丢失
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uUnknownErrorAndDataLost);
|
| | | this.ShowMassage(ShowMsgType.Tip, msg);
|
| | | return;
|
| | | }
|
| | | //添加缓存
|
| | | UserCenterResourse.ListMemberInfo.Add(memberInfoRes);
|
| | | UserCenterLogic.SaveLocalMemberListInfo();
|
| | |
|
| | | //成员添加成功
|
| | | var form = new AddMemberSuccessForm();
|
| | | form.AddForm(memberInfoRes);
|
| | | form.FormCloseEvent += (() =>
|
| | | {
|
| | | this.CloseForm();
|
| | | //关闭手动输入成员ID的画面
|
| | | this.CloseFormByFormName("AddMemberByIdForm");
|
| | | this.CloseForm();
|
| | | //关闭手动输入成员ID的画面
|
| | | 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
|
| | | }
|
| | | }
|