private void InitView() { //设置标题栏 var img_header_back = FindViewById <ImageView> (Resource.Id.img_header_back); img_header_back.Click += (sender, e) => { this.Finish(); OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); }; var tv_back = FindViewById <TextView> (Resource.Id.tv_back); tv_back.Text = "返回"; var tv_desc = FindViewById <TextView> (Resource.Id.tv_desc); //取得上一页面传递过来的值包括是什么类型发送验证码(找回密码\修改支付密码\修改密码) var bundle = Intent.Extras; sendType = bundle.GetString("SendType"); phoneNumber = bundle.GetString("PhoneNumber"); tv_SendCodeStatusShow = FindViewById <TextView>(Resource.Id.tv_SendCodeStatusShow); edit_Phone = FindViewById <EditText> (Resource.Id.edit_Phone); edit_Phone.Text = phoneNumber; if (sendType == "FindPwd") { tv_desc.Text = "找回登录密码"; edit_Phone.Enabled = true; edit_Phone.Hint = "请输入手机号"; } else if (sendType == "ModifyPwd") { tv_desc.Text = "修改登录密码"; edit_Phone.Enabled = false; SetPhoneNumberShow(); } else if (sendType == "ModifyPayPwd") { tv_desc.Text = "设置支付密码"; edit_Phone.Enabled = false; SetPhoneNumberShow(); } edit_SecurityCode = FindViewById <EditText> (Resource.Id.edit_SecurityCode); btn_Send = FindViewById <Button> (Resource.Id.btn_Send); btn_Next = FindViewById <Button> (Resource.Id.btn_Next); //初始化计时器,启动 mc = new MyCount(this, 60000, 1000); //发送验证码 btn_Send.Click += (sender, e) => { tv_SendCodeStatusShow.Visibility = ViewStates.Invisible; btn_Send.Enabled = false; SendCode(); }; edit_SecurityCode.TextChanged += (sender, e) => { if (edit_SecurityCode.Text.Length > 0) { btn_Next.Enabled = true; } else { btn_Next.Enabled = false; } }; //下一步 btn_Next.Click += (sender, e) => { var inputCode = edit_SecurityCode.Text; if (string.IsNullOrEmpty(inputCode) || !EldYoungUtil.IsSecurityCode(inputCode)) { Toast.MakeText(this, "请输入接收到的手机验证码,且不能为空", ToastLength.Short).Show(); return; } if (inputCode != securityCode) { Toast.MakeText(this, "输入验证码不正确,请重新填写", ToastLength.Short).Show(); return; } var intent = new Intent(this, typeof(SetPasswordActivity)); var nextbundle = new Bundle(); nextbundle.PutString("SendType", sendType); if (sendType == "FindPwd") { nextbundle.PutString("PhoneNumber", phoneNumber); } intent.PutExtras(nextbundle); StartActivity(intent); if (sendType != "FindPwd") { this.Finish(); } ProgressDialogUtil.StopProgressDialog(); }; //拨打客服 var tv_customPhone = FindViewById <TextView>(Resource.Id.tv_customPhone); var customPhoneNum = tv_customPhone.Text; tv_customPhone.Click += (sender, e) => { Intent intent = new Intent(Intent.ActionCall, Android.Net.Uri.Parse("tel:" + customPhoneNum)); StartActivity(intent); }; }
private void InitView() { //设置标题栏 var img_header_back = FindViewById <ImageView> (Resource.Id.img_header_back); img_header_back.Click += (sender, e) => { this.Finish(); OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); }; var tv_back = FindViewById <TextView> (Resource.Id.tv_back); tv_back.Text = "返回"; var tv_desc = FindViewById <TextView> (Resource.Id.tv_desc); tv_desc.Text = "填写短信验证码"; btn_Submit = FindViewById <Button> (Resource.Id.btn_Submit); btn_Send = FindViewById <Button> (Resource.Id.btn_Send); tv_PhoneShow = FindViewById <TextView> (Resource.Id.tv_PhoneShow); edit_SecurityCode = FindViewById <EditText> (Resource.Id.edit_SecurityCode); tv_SendCodeStatusShow = FindViewById <TextView>(Resource.Id.tv_SendCodeStatusShow); //取得上一页面传递过来的值 var bundle = Intent.Extras; //从bundle中获取值赋值显示 phoneNum = bundle.GetString("phoneNum"); nickName = bundle.GetString("nickName"); passWord = bundle.GetString("passWord"); securityCode = bundle.GetString("securityCode"); tv_PhoneShow.Text = phoneNum; //初始化计时器,启动 mc = new MyCount(this, 60000, 1000); mc.Start(); edit_SecurityCode.TextChanged += (sender, e) => { if (edit_SecurityCode.Text.Length > 0) { btn_Submit.Enabled = true; btn_Submit.SetBackgroundResource(Resource.Color.blue); } else { btn_Submit.Enabled = false; btn_Submit.SetBackgroundResource(Resource.Color.lightgray); } }; btn_Submit.Click += (sender, e) => { var inputCode = edit_SecurityCode.Text; if (string.IsNullOrEmpty(inputCode) || !EldYoungUtil.IsSecurityCode(inputCode)) { Toast.MakeText(this, "请输入接收到的手机验证码,且不能为空", ToastLength.Short).Show(); return; } if (inputCode != securityCode) { Toast.MakeText(this, "输入验证码不正确,请重新填写", ToastLength.Short).Show(); return; } Reister(); }; //发送验证码 btn_Send.Click += (sender, e) => { tv_SendCodeStatusShow.Visibility = ViewStates.Invisible; btn_Send.Clickable = false; btn_Send.SetBackgroundResource(Resource.Color.lightgray); btn_Send.SetTextColor(Resources.GetColor(Resource.Color.ingray)); SendSMS(phoneNum); }; }