| | |
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | string iconPath = System.IO.Path.Combine(UserCenterResourse.Option.UserPictruePath, memberResult.DistributedMark + ".png");
|
| | | //写入头像内容
|
| | | 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;
|
| | | btnUserIcon.ImagePath = iconPath;
|
| | | btnUserIcon.Height = this.GetPictrueRealSize(207);
|
| | | btnUserIcon.Width = this.GetPictrueRealSize(207);
|
| | | btnUserIcon.Radius = (uint)this.GetPictrueRealSize(207) / 2;
|
| | | if (memberResult.HeadImage != null)
|
| | | {
|
| | | btnUserIcon.ImageBytes = memberResult.HeadImage;
|
| | | }
|
| | | else
|
| | | {
|
| | | btnUserIcon.ImagePath = "Center/Admin.png";
|
| | | }
|
| | | btnUserIcon.Y = Application.GetRealHeight(219);
|
| | | btnUserIcon.Gravity = Gravity.CenterHorizontal;
|
| | | bodyFrameLayout.AddChidren(btnUserIcon);
|
| | |
|
| | | //成员ID
|
| | | var btnUserId = new NormalViewControl(800, 50, true);
|
| | | btnUserId.IsBold = true;
|
| | | btnUserId.Y = Application.GetRealHeight(472);
|
| | | btnUserId.Gravity = Gravity.CenterHorizontal;
|
| | | btnUserId.Text = memberResult.Account;
|
| | |
| | |
|
| | | //昵称
|
| | | var btnName = new NormalViewControl(800, 55, true);
|
| | | btnName.IsBold = true;
|
| | | btnName.Y = Application.GetRealHeight(541);
|
| | | btnName.Gravity = Gravity.CenterHorizontal;
|
| | | btnName.TextAlignment = TextAlignment.Center;
|
| | |
| | | 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);
|
| | | bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/BindSubAccount", false, pra);
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | |
| | |
|
| | | //获取这个成员的SubDistributedMark
|
| | | var pra2 = new MemberListInfoPra();
|
| | | string resultValue = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra2);
|
| | | string resultValue = UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra2);
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | |
|
| | | if (resultValue == null)
|
| | | if (string.IsNullOrEmpty(resultValue) == true)
|
| | | {
|
| | | //出现未知错误,数据丢失
|
| | | 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)
|
| | | //当账号绑定了邮箱时,它返回的是邮箱账号
|
| | | if (info.Account == memberResult.Account
|
| | | || info.Account == memberResult.Email)
|
| | | {
|
| | | memberInfoRes = info;
|
| | | break;
|
| | |
| | | }
|
| | | if (memberInfoRes == null)
|
| | | {
|
| | | //出现未知错误,数据丢失
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uUnknownErrorAndDataLost);
|
| | | //出现意外情况,数据丢失
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uUnKnownErrorAndLostData);
|
| | | this.ShowMassage(ShowMsgType.Tip, msg);
|
| | | return;
|
| | | }
|
| | | //添加缓存
|
| | | UserCenterResourse.ListMemberInfo.Add(memberInfoRes);
|
| | | UserCenterLogic.SaveLocalMemberListInfo();
|
| | |
|
| | | //成员添加成功
|
| | | var form = new AddMemberSuccessForm();
|
| | | form.AddForm(memberInfoRes);
|
| | | form.FormCloseEvent += (() =>
|
| | | string iconPath = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, memberInfoRes.DistributedMark + ".png");
|
| | | if (memberResult.HeadImage != null)
|
| | | {
|
| | | this.CloseForm();
|
| | | //关闭手动输入成员ID的画面
|
| | | this.CloseFormByFormName("AddMemberByIdForm");
|
| | | //写入头像内容
|
| | | Shared.IO.FileUtils.WriteFileByBytes(iconPath, memberResult.HeadImage);
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //成员添加成功
|
| | | var form = new AddMemberSuccessForm();
|
| | | form.AddForm(memberInfoRes, memberInfoRes.DistributedMark);
|
| | | form.FormCloseEvent += (() =>
|
| | | {
|
| | | this.CloseForm();
|
| | | //关闭手动输入成员ID的画面
|
| | | this.CloseFormByFormName("AddMemberByIdForm");
|
| | | //添加成员
|
| | | this.LoadFormMethodByName("MemberListForm", "AddRowLayoutByOtherForm", memberInfoRes);
|
| | | });
|
| | | });
|
| | | }
|
| | |
|