using System; namespace Shared.Phone.UserCenter.Member { /// /// 根据账号名添加成员的画面 /// public class AddMemberByIdForm : EditorCommonForm { #region ■ 变量声明___________________________ #endregion #region ■ 初始化_____________________________ /// /// 画面显示(底层会固定调用此方法,借以完成画面创建) /// public void ShowForm() { //设置标题信息 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddMember)); //初始化中部控件 this.InitMiddleFrame(); } /// /// 初始化中部控件 /// private void InitMiddleFrame() { //清空bodyFrame this.ClearBodyFrame(); var frame = new FrameLayout(); frame.Height = Application.GetRealHeight(248); frame.BackgroundColor = UserCenterColor.Current.White; bodyFrameLayout.AddChidren(frame); var rowAccount = new FrameRowControl(); rowAccount.UseClickStatu = false; rowAccount.Y = Application.GetRealHeight(23); frame.AddChidren(rowAccount); //底线 var btnLine = rowAccount.AddBottomLine(); //请输入需要加入成员的ID(Email/手机号) var txtCode = new TextInputControl(Application.GetRealWidth(900), rowAccount.Height, false); txtCode.X = ControlCommonResourse.XXLeft; txtCode.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputAddMenberID); rowAccount.AddChidren(txtCode, ChidrenBindMode.NotBind); //联动线的状态 txtCode.btnLine = btnLine; //下一步 var btnBottom = new BottomClickButton(688); btnBottom.Y = Application.GetRealHeight(706); btnBottom.TextID = R.MyInternationalizationString.uNextway; bodyFrameLayout.AddChidren(btnBottom); btnBottom.ButtonClickEvent += ((sender, e) => { //成员ID检测 if (this.CheckAccountId(txtCode.Text.Trim()) == false) { return; } //检索成员信息 string strCode = txtCode.Text.Trim(); HdlThreadLogic.Current.RunThread(() => { this.SearchMemberInfo(strCode); }); }); } #endregion #region ■ 搜索ID_____________________________ /// /// 搜索指定ID的信息 /// /// 成员ID /// 信息控件 private void SearchMemberInfo(string accountId) { //开启进度条 this.ShowProgressBar(); var pra = new AccountInfoPra(); pra.Account = accountId; var byteData = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new System.Collections.Generic.List() { "AccountNoExists" }); //关闭进度条 this.CloseProgressBar(); if (byteData == null) { //异常 return; } var revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject(System.Text.Encoding.UTF8.GetString(byteData)); if (revertObj.StateCode == "AccountNoExists") { //成员不存在 var form = new MemberNotEsixtForm(); form.AddForm(); return; } var infoResult = Newtonsoft.Json.JsonConvert.DeserializeObject(revertObj.ResponseData.ToString()); infoResult.Account = accountId; HdlThreadLogic.Current.RunMain(() => { var form = new AddMemberInfoForm(); form.AddForm(infoResult); }); } /// /// 检查输入的成员ID /// /// /// private bool CheckAccountId(string accountId) { if (accountId == string.Empty) { //请输入需要加入成员的ID this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uPleaseInputAddMemberId)); return false; } return true; } #endregion } }