| | |
| | | var account = etAccount.Text.Trim(); |
| | | if ((sender as Button).IsSelected) |
| | | { |
| | | //加载Loading效果 |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | |
| | | int time = 60; |
| | | new Thread(() => |
| | | { |
| | | //1.先检查账号是否注册过 |
| | | var result = pm.GetRegionByAccount(account); |
| | | if (result.Code != StateCode.SUCCESS) |
| | | try |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(result.Code); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | //2.1检测当前配置域名是否一致,不一致则替换 |
| | | CheckAndSetUserRequestHost(result); |
| | | |
| | | //2.2已经注册过,发送验证码找回密码 |
| | | Application.RunOnMainThread(() => |
| | | //1.先检查账号是否注册过 |
| | | var result = pm.GetRegionByAccount(account); |
| | | if (result.Code != StateCode.SUCCESS) |
| | | { |
| | | //短信发送间隔60s |
| | | (sender as Button).IsSelected = false; |
| | | etVerificationCode.Foucs = true; |
| | | }); |
| | | //2.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(); |
| | | |
| | | ResponsePackNew resultObj; |
| | | //2.1请求获取验证码 |
| | | if (registerType == 1)//邮箱 |
| | | { |
| | | resultObj = pm.VerificationCodeSend(VerifyType.FIND_PASSWORD, account); |
| | | IMessageCommon.Current.ShowErrorInfoAlter(result.Code); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | resultObj = pm.VerificationCodeSend(VerifyType.FIND_PASSWORD, account, true, phoneZoneCode); |
| | | } |
| | | |
| | | if (resultObj.Code != StateCode.SUCCESS) |
| | | { |
| | | // 提示错误 |
| | | IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); |
| | | //2.1检测当前配置域名是否一致,不一致则替换 |
| | | CheckAndSetUserRequestHost(result); |
| | | //2.2已经注册过,发送验证码找回密码 |
| | | ResponsePackNew resultObj; |
| | | //2.3请求获取验证码 |
| | | if (registerType == 1)//邮箱 |
| | | { |
| | | resultObj = pm.VerificationCodeSend(VerifyType.FIND_PASSWORD, account); |
| | | } |
| | | else |
| | | { |
| | | resultObj = pm.VerificationCodeSend(VerifyType.FIND_PASSWORD, account, true, phoneZoneCode); |
| | | } |
| | | |
| | | if (resultObj.Code != StateCode.SUCCESS) |
| | | { |
| | | // 提示错误 |
| | | IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); |
| | | } |
| | | else |
| | | { |
| | | //3.发送验证码成功,开始计时 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | //短信发送间隔60s |
| | | (sender as Button).IsSelected = false; |
| | | etVerificationCode.Foucs = true; |
| | | }); |
| | | //2.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(); |
| | | |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | LoadEvent_AutoLogin(); |
| | | callbackAction?.Invoke(account); |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.Hide(); |
| | | } |
| | | ShowAutoLoginDialog(account, password, isPhone); |
| | | }); |
| | | |
| | | } |
| | | else |
| | | { |
| | | // 2020-11-13 待修改 验证码错误 警告提示 |
| | | //btnVerificationCodeViewBottomLine.BackgroundColor = CSS_Color.AuxiliaryColor2; |
| | | //btnVerificationCodeViewBottomLine.Height = Application.GetRealHeight(2); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | waitPage.Hide(); |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.Hide(); |
| | | } |
| | | |
| | | // 验证码错误 警告提示 |
| | | if (resultObj.Code == StateCode.VERIFICATION_CODE_WRONG) |
| | | { |
| | | btnVerificationCodeViewBottomLine.BackgroundColor = CSS_Color.AuxiliaryColor2; |
| | | btnVerificationCodeViewBottomLine.Height = Application.GetRealHeight(2); |
| | | } |
| | | }); |
| | | // 提示错误 |
| | | IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 住宅成功之后自动登录 |
| | | /// 显示自动自动登录事件 |
| | | /// </summary> |
| | | void LoadEvent_AutoLogin() |
| | | void ShowAutoLoginDialog(string account, string password, bool isPhone) |
| | | { |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | FrameLayout frame = new FrameLayout() |
| | | FrameLayout dialogView = new FrameLayout(); |
| | | dialogView.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | dialog.AddChidren(dialogView); |
| | | |
| | | FrameLayout contentView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(198), |
| | | Y = Application.GetRealWidth(200), |
| | | Width = Application.GetRealWidth(288), |
| | | Height = Application.GetRealHeight(206), |
| | | Height = Application.GetRealWidth(270), |
| | | Radius = (uint)Application.GetRealWidth(6), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | BorderWidth = 0, |
| | | BorderColor = 0x00000000, |
| | | }; |
| | | dialog.AddChidren(frame); |
| | | dialogView.AddChidren(contentView); |
| | | |
| | | Button btnAccountText = new Button() |
| | | contentView.Y = (dialogView.Height - contentView.Height) / 2; |
| | | |
| | | Button btnTitleIcon = new Button() |
| | | { |
| | | X = Application.GetRealWidth(108), |
| | | Y = contentView.Y - Application.GetRealWidth(71), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealWidth(160), |
| | | UnSelectedImagePath = "Public/Dialog/DialogTipTitleIcon_1.png" |
| | | }; |
| | | dialogView.AddChidren(btnTitleIcon); |
| | | btnTitleIcon.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | Button btnMsg = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(40), |
| | | Height = Application.GetRealHeight(17 + 14 + 14), |
| | | IsMoreLines = true, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | //Text = "s是生生世世", |
| | | }; |
| | | frame.AddChidren(btnAccountText); |
| | | |
| | | Button btnTipRegisterSuccess = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(123), |
| | | Height = Application.GetRealHeight(30), |
| | | TextAlignment = TextAlignment.Center, |
| | | Y = Application.GetRealWidth(88), |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealWidth(44), |
| | | TextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.PasswordChangeSuccessfully, |
| | | TextID = StringId.ModifySuccess |
| | | }; |
| | | frame.AddChidren(btnTipRegisterSuccess); |
| | | contentView.AddChidren(btnMsg); |
| | | |
| | | Button btnAutoLoginTip = new Button() |
| | | Button btnMsg2 = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = btnTipRegisterSuccess.Bottom, |
| | | Height = Application.GetRealHeight(17 + 8), |
| | | TextAlignment = TextAlignment.Center, |
| | | Y = btnMsg.Bottom + Application.GetRealWidth(8), |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealWidth(60), |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextID = StringId.AutomaticallyLogin, |
| | | TextID = StringId.YourPasswordHasBeenChanged, |
| | | TextAlignment = TextAlignment.TopCenter, |
| | | IsMoreLines = true |
| | | }; |
| | | //frame.AddChidren(btnAutoLoginTip); |
| | | contentView.AddChidren(btnMsg2); |
| | | |
| | | Button btnHeadImage = new Button() |
| | | |
| | | Button btnSkipBindPage = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(150), |
| | | Width = Application.GetRealWidth(84), |
| | | Height = Application.GetRealWidth(84), |
| | | Radius = (uint)Application.GetRealWidth(42), |
| | | BorderColor = 0x00000000, |
| | | BorderWidth = 0, |
| | | UnSelectedImagePath = "LoginIcon/2.png", |
| | | Y = Application.GetRealWidth(194), |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealWidth(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | Radius = (uint)Application.GetRealWidth(22), |
| | | BackgroundColor = CSS_Color.MainColor, |
| | | TextID = StringId.Login, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | dialog.AddChidren(btnHeadImage); |
| | | contentView.AddChidren(btnSkipBindPage); |
| | | |
| | | btnSkipBindPage.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | this.Close(); |
| | | |
| | | AutoLoginAction?.Invoke(account, password, isPhone); |
| | | |
| | | }; |
| | | |
| | | dialog.Show(); |
| | | |
| | | new Thread(() => |
| | | { |
| | | Thread.Sleep(1500); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | dialog.Close(); |
| | | this.Close(); |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |