From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 17 十二月 2020 09:07:13 +0800 Subject: [PATCH] 新云端Ver1.3 --- ZigbeeApp/Shared/Phone/UserCenter/Member/AddMemberInfoForm.cs | 129 ++++++++++++++++++------------------------- 1 files changed, 54 insertions(+), 75 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Member/AddMemberInfoForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Member/AddMemberInfoForm.cs index a4e7f3b..fe53862 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Member/AddMemberInfoForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Member/AddMemberInfoForm.cs @@ -13,7 +13,7 @@ /// <summary> /// 鎴愬憳淇℃伅 /// </summary> - private AccountInfoResult memberResult = null; + private AccountInfoResult AccountResult = null; #endregion @@ -25,7 +25,7 @@ /// <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)); @@ -43,37 +43,41 @@ //娓呯┖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 (AccountResult.HeadImage != null) + { + btnUserIcon.ImageBytes = AccountResult.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; + 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; - //濡傛灉瀹冩湰韬氨娌″悕瀛楃殑璇濓紝鎶婁粬鐨処D浣滀负鏄电О - btnName.Text = string.IsNullOrEmpty(memberResult.UserName) == true ? memberResult.Account : memberResult.UserName; + btnName.Text = AccountResult.MemberName; bodyFrameLayout.AddChidren(btnName); //璇风‘璁よ处鍙锋槸鍚︽纭畕0}濡傛纭鐐瑰嚮纭 @@ -83,6 +87,7 @@ 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; @@ -100,7 +105,10 @@ btnOk.ButtonClickEvent += (sender, e) => { //娣诲姞鎴愬憳 - this.DoAddMember(); + HdlThreadLogic.Current.RunThread(() => + { + this.DoAddMember(); + }); }; } @@ -111,85 +119,56 @@ /// <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; + } - //鑾峰彇杩欎釜鎴愬憳鐨凷ubDistributedMark - 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> - /// 瀛愯处鍙稩D - /// </summary> - public string SubAccount = string.Empty; - /// <summary> - /// 浣忓畢ID - /// </summary> - public string HouseDistributedMark = Common.Config.Instance.Home.Id; - } #endregion } } -- Gitblit v1.8.0