📄 mobilephonepage.cs
字号:
namespace Imps.Client.Pc.Password
{
using Imps.Client;
using Imps.Client.Core;
using Imps.Client.Core.Password;
using Imps.Client.Pc.BizControls;
using Imps.Client.Pc.Controls;
using Imps.Client.Pc.Utils;
using Imps.Client.Resource;
using Imps.Client.Utils;
using Imps.Utils;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class MobilePhonePage : StepPageBase
{
private EventHandler<CertPicEventArgs> _certPicRecivedHandler;
private EventHandler<CertSmsEventArgs> _certSmsRequestSenedHandler;
private EventHandler _showHandler;
private EventHandler<SysCfgEventArgs> _sysCfgAvaildHanlder;
private vscroll_widget _vscroll;
private IContainer components;
private GroupBox groupBox1;
private GroupBox groupBox2;
private Label label1;
private XLabel lbLoading;
private XLabel lbMobileNo;
private XLabel lbSmsKtTip;
private XLabel lbValiCode;
private PictureBox pbLoading;
private PictureBox pbValiCode;
private XTextBox txtMobileNo;
private XTextBox txtValiCode;
public MobilePhonePage(SetPasswordWizard host) : base(host)
{
this._vscroll = scroll_maker.instance.vscroll();
this.InitializeComponent();
string text = string.Format(StringTable.User.MsgForgetPass, Imps.Client.Core.FixedClientSetting.Instance.ChangePasswordNo);
this.lbSmsKtTip.Text = text;
this.AttachEventHandler();
base.Disposed += new EventHandler(this.MobilePhonePage_Disposed);
this.Init();
this.LoadResource();
}
private void _host_OnSysCfgAvaild(object sender, SysCfgEventArgs e)
{
ServerUriSetting serverUriSetting = base._host.Config.SystemSetting.ServerUriSetting;
if (e.IsValid)
{
if (!string.IsNullOrEmpty(base._host.passwordData.UriGetPic) && !string.IsNullOrEmpty(base._host.passwordData.UriGetGeneralInfo))
{
ModifyPassword.GetCertPic(base._host.passwordData);
}
else
{
this.ShowLoadError(0x44c, e);
}
}
else
{
this.ShowLoadError(0x44c, e);
}
}
private void _host_Shown(object sender, EventArgs e)
{
this.txtMobileNo.Focus();
this.pbLoading.Image = ImpsResources.GetImage("Images.loading.gif");
}
private void AttachEventHandler()
{
this._showHandler = new EventHandler(this._host_Shown);
base._host.add_Shown(this._showHandler);
base.Load += new EventHandler(this.MobilePhonePage_Load);
this._certPicRecivedHandler = new EventHandler<CertPicEventArgs>(this, (IntPtr) this.ModifyPassword_OnCertPicRecived);
ModifyPassword.OnCertPicRecived += this._certPicRecivedHandler;
this._certSmsRequestSenedHandler = new EventHandler<CertSmsEventArgs>(this, (IntPtr) this.ModifyPassword_OnSmsCertCodeRequestSended);
ModifyPassword.OnSmsCertCodeRequestSended += this._certSmsRequestSenedHandler;
this._sysCfgAvaildHanlder = new EventHandler<SysCfgEventArgs>(this, (IntPtr) this._host_OnSysCfgAvaild);
base._host.OnSysCfgAvaild += this._sysCfgAvaildHanlder;
}
private bool CheckData()
{
this.txtMobileNo.Text = this.txtMobileNo.Text.Trim();
this.txtValiCode.Text = this.txtValiCode.Text.Trim();
if (this.txtMobileNo.Text.Length > 0)
{
if (!ImpsHelper.IsCmccMobileNo(this.txtMobileNo.Text))
{
BalloonHelper.ShowBallon(this.txtMobileNo, "请输入中国移动的手机号码!", "错误!", 3, 0x5dc);
this.txtMobileNo.SelectAll();
this.txtMobileNo.Focus();
return false;
}
if (!StringHelper.IsAscii(this.txtMobileNo.Text))
{
BalloonHelper.ShowBallon(this.txtMobileNo, StringTable.MsgAsciiOnly, "请注意", 1, 0x5dc);
return false;
}
}
else
{
BalloonHelper.ShowBallon(this.txtMobileNo, "您尚未填写手机号码!", "错误!", 3, 0x5dc);
this.txtMobileNo.Focus();
return false;
}
if (this.txtValiCode.Text.Length == 0)
{
BalloonHelper.ShowBallon(this.txtValiCode, "您尚未填写验证码!", "错误!", 3, 0x5dc);
this.txtValiCode.Focus();
return false;
}
if (!StringHelper.IsAscii(this.txtValiCode.Text))
{
BalloonHelper.ShowBallon(this.txtValiCode, StringTable.MsgAsciiOnly, "请注意", 1, 0x5dc);
return false;
}
return true;
}
public override void DetachEventHandler()
{
if (this._showHandler != null)
{
base._host.remove_Shown(this._showHandler);
}
if (this._sysCfgAvaildHanlder != null)
{
base._host.OnSysCfgAvaild -= this._sysCfgAvaildHanlder;
}
if (this._certPicRecivedHandler != null)
{
ModifyPassword.OnCertPicRecived -= this._certPicRecivedHandler;
}
if (this._certSmsRequestSenedHandler != null)
{
ModifyPassword.OnSmsCertCodeRequestSended -= this._certSmsRequestSenedHandler;
}
}
protected override void DisableAllControls()
{
this.txtMobileNo.Enabled = false;
this.txtValiCode.Enabled = false;
base._host.DisableAllButtons();
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
public override bool GetValidData()
{
if (this.CheckData())
{
long mobileNo = 0;
ImpsHelper.TryParseMobileNo(this.txtMobileNo.Text, out mobileNo);
base._host.passwordData.MobileNo = mobileNo.ToString();
base._host.passwordData.CertPicCode = this.txtValiCode.Text;
return true;
}
return false;
}
private void Init()
{
ControlHelper.SetAcceptDigitOnly(this.txtMobileNo, true);
ControlHelper.ForceControlImeDisable(this.txtValiCode, true);
base._host.passwordData.ImgCertCode = null;
bool enable = base._host.passwordData.Flag.AgreementRecived && base._host.passwordData.Flag.CertPicRecived;
this.ShowFormIssue(enable);
this.ShowLoading(!enable);
base._host.passwordData.Flag.CertPicRecived = false;
this.txtValiCode.Enabled = false;
}
private void InitializeComponent()
{
this.lbSmsKtTip = new XLabel();
this.pbValiCode = new PictureBox();
this.txtValiCode = new XTextBox();
this.lbValiCode = new XLabel();
this.pbLoading = new PictureBox();
this.lbLoading = new XLabel();
this.lbMobileNo = new XLabel();
this.txtMobileNo = new XTextBox();
this.groupBox1 = new GroupBox();
this.label1 = new Label();
this.groupBox2 = new GroupBox();
this.pbValiCode.BeginInit();
this.pbLoading.BeginInit();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
base.SuspendLayout();
this.lbSmsKtTip.BorderColor = Color.Empty;
this.lbSmsKtTip.ButtonBorderStyle = ButtonBorderStyle.None;
this.lbSmsKtTip.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
this.lbSmsKtTip.Location = new Point(6, 0x11);
this.lbSmsKtTip.Name = "lbSmsKtTip";
this.lbSmsKtTip.Size = new Size(0x16a, 80);
this.lbSmsKtTip.TabIndex = 0x29;
this.lbSmsKtTip.UseMnemonic = false;
this.pbValiCode.set_ErrorImage(null);
this.pbValiCode.set_InitialImage(null);
this.pbValiCode.Location = new Point(0xdf, 0x51);
this.pbValiCode.Name = "pbValiCode";
this.pbValiCode.Size = new Size(110, 0x15);
this.pbValiCode.SizeMode = PictureBoxSizeMode.AutoSize;
this.pbValiCode.TabIndex = 0x21;
this.pbValiCode.TabStop = false;
this.txtValiCode.BackColor = Color.White;
this.txtValiCode.BorderStyle = BorderStyle.FixedSingle;
this.txtValiCode.EmptyTextTip = "请输入图片中的验证数字";
this.txtValiCode.EmptyTextTipColor = Color.DarkGray;
this.txtValiCode.Location = new Point(0x48, 0x51);
this.txtValiCode.MaxLength = 8;
this.txtValiCode.Name = "txtValiCode";
this.txtValiCode.Size = new Size(0x91, 0x15);
this.txtValiCode.TabIndex = 0x19;
this.lbValiCode.set_AutoSize(true);
this.lbValiCode.BorderColor = Color.Empty;
this.lbValiCode.ButtonBorderStyle = ButtonBorderStyle.None;
this.lbValiCode.Font = new Font("宋体", 9f);
this.lbValiCode.Location = new Point(0x13, 0x55);
this.lbValiCode.Name = "lbValiCode";
this.lbValiCode.Size = new Size(0x35, 12);
this.lbValiCode.TabIndex = 0x1f;
this.lbValiCode.Text = "验证码:";
this.lbValiCode.UseMnemonic = false;
this.pbLoading.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
this.pbLoading.set_ErrorImage(null);
this.pbLoading.set_InitialImage(null);
this.pbLoading.Location = new Point(0x10, 0x7c);
this.pbLoading.Name = "pbLoading";
this.pbLoading.Size = new Size(50, 0x34);
this.pbLoading.TabIndex = 0x27;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -