| | |
| | | |
| | | string account = etAccount.Text.Trim(); |
| | | int time = 60; |
| | | //加载Loading效果 |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | |
| | | new Thread(() => |
| | | { |
| | | //1.先检查账号是否注册过 |
| | | var result = pm.GetRegionByAccount(account); |
| | | //2.账号不存在,才允许继续注册 |
| | | if (result.Code == StateCode.ACCOUNT_NOT_EXIST) |
| | | try |
| | | { |
| | | //账号不存在 未注册允许发送验证码注册 |
| | | Application.RunOnMainThread(() => |
| | | //1.先检查账号是否注册过 |
| | | var result = pm.GetRegionByAccount(account); |
| | | //2.账号不存在,才允许继续注册 |
| | | if (result.Code == StateCode.ACCOUNT_NOT_EXIST) |
| | | { |
| | | //短信发送间隔60s |
| | | (sender as Button).IsSelected = false; |
| | | //账号不存在 未注册允许发送验证码注册 |
| | | |
| | | }); |
| | | //2.1 开始倒计时 |
| | | new Thread(() => |
| | | { |
| | | while (time > 0) |
| | | //2.2 获取验证码 |
| | | ResponsePackNew resultObj; |
| | | if (registerType == 1)//邮箱 |
| | | { |
| | | time--; |
| | | resultObj = pm.VerificationCodeSend(VerifyType.REGISTER_USER, account); |
| | | } |
| | | else |
| | | { |
| | | resultObj = pm.VerificationCodeSend(VerifyType.REGISTER_USER, account, true, phoneZoneCode); |
| | | } |
| | | |
| | | if (resultObj.Code != StateCode.SUCCESS) |
| | | { |
| | | // 提示错误 |
| | | IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); |
| | | } |
| | | else |
| | | { |
| | | //2.1 开始倒计时 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | (sender as Button).Text = time.ToString() + "s"; |
| | | }); |
| | | Thread.Sleep(1000); |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | //回复获取短信按钮事件 |
| | | (sender as Button).IsSelected = true; |
| | | (sender as Button).TextID = StringId.GetVerificationCode; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | //短信发送间隔60s |
| | | (sender as Button).IsSelected = false; |
| | | |
| | | //2.2 获取验证码 |
| | | ResponsePackNew resultObj; |
| | | if (registerType == 1)//邮箱 |
| | | }); |
| | | new Thread(() => |
| | | { |
| | | while (time > 0) |
| | | { |
| | | time--; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | (sender as Button).Text = time.ToString() + "s"; |
| | | }); |
| | | Thread.Sleep(1000); |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | //回复获取短信按钮事件 |
| | | (sender as Button).IsSelected = true; |
| | | (sender as Button).TextID = StringId.GetVerificationCode; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | } |
| | | else if (result.Code.ToUpper() == StateCode.SUCCESS) |
| | | { |
| | | resultObj = pm.VerificationCodeSend(VerifyType.REGISTER_USER, account); |
| | | //3.提示账号已存在,无法重复注册 |
| | | Utlis.ShowAlertOnMainThread(Language.StringByID(StringId.AccountAlreadyUse)); |
| | | } |
| | | else |
| | | { |
| | | resultObj = pm.VerificationCodeSend(VerifyType.REGISTER_USER, account, true, phoneZoneCode); |
| | | //4.提示其它异常错误 |
| | | IMessageCommon.Current.ShowErrorInfoAlter(result.Code); |
| | | } |
| | | |
| | | if (resultObj.Code != StateCode.SUCCESS) |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | // 提示错误 |
| | | IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); |
| | | } |
| | | |
| | | } |
| | | else if (result.Code.ToUpper() == StateCode.SUCCESS) |
| | | { |
| | | //3.提示账号已存在,无法重复注册 |
| | | Utlis.ShowAlertOnMainThread(Language.StringByID(StringId.AccountAlreadyUse)); |
| | | } |
| | | else |
| | | { |
| | | //4.提示其它异常错误 |
| | | IMessageCommon.Current.ShowErrorInfoAlter(result.Code); |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |