📄 licencepage.cs
字号:
namespace Imps.Client.Pc.Provsion2
{
using Imps.Client;
using Imps.Client.Core;
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.Runtime.CompilerServices;
using System.Windows.Forms;
public class LicencePage : ProvsionControlBase
{
private EventHandler<CertPicEventArgs> _certPicRecivedHandler;
private EventHandler<CertSmsEventArgs> _certSmsRequestSenedHandler;
private EventHandler _showHandler;
private EventHandler<AgreementEventArgs> _svcAgreementRecivedHandler;
private EventHandler<SysCfgEventArgs> _sysCfgAvaildHanlder;
private vscroll_widget _vscroll;
private CheckBox chkAgreeLicence;
private IContainer components;
private GroupBox gbLicence;
private GroupBox groupBox1;
private GroupBox groupBox2;
private XLabel lbBName;
private XLabel lbLoading;
private XLabel lbMobileNo;
private XLabel lbSmsKtTip;
private XLabel lbValiCode;
private XLabel lbValiCodeTip;
private PictureBox pbLoading;
private PictureBox pbValiCode;
private volatile int respCounter;
private XTextBox txtLicence;
private XTextBox txtMobileNo;
private XTextBox txtValiCode;
public LicencePage(ProvisionWizard host) : base(host)
{
this._vscroll = scroll_maker.instance.vscroll();
this.InitializeComponent();
this.AttachEventHandler();
base.Disposed += new EventHandler(this.LicencePage_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.ProvsionData.ProvsionUrl.UriGetPic) && !string.IsNullOrEmpty(base._host.ProvsionData.ProvsionUrl.UriGetGeneralInfo))
{
Imps.Client.Core.Provisioning.GetCertPic(base._host.ProvsionData);
Imps.Client.Core.Provisioning.GetAgreement(base._host.ProvsionData);
}
else
{
this.ShowLoadError(0x44c, e);
}
}
else
{
this.ShowLoadError(0x44c, e);
}
}
private void _host_Shown(object sender, EventArgs e)
{
this.txtMobileNo.Focus();
if (base._host.ProvsionData.Agreement.Length == 0)
{
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.LicencePage_Load);
this._certPicRecivedHandler = new EventHandler<CertPicEventArgs>(this, (IntPtr) this.Provisioning_OnCertPicRecived);
Imps.Client.Core.Provisioning.OnCertPicRecived += this._certPicRecivedHandler;
this._certSmsRequestSenedHandler = new EventHandler<CertSmsEventArgs>(this, (IntPtr) this.Provisioning_OnSmsCertCodeRequestSended);
Imps.Client.Core.Provisioning.OnSmsCertCodeRequestSended += this._certSmsRequestSenedHandler;
this._svcAgreementRecivedHandler = new EventHandler<AgreementEventArgs>(this, (IntPtr) this.Provisioning_OnAgreementRecived);
Imps.Client.Core.Provisioning.OnAgreementRecived += this._svcAgreementRecivedHandler;
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;
}
private void chkAgreeLicence_CheckStateChanged(object sender, EventArgs e)
{
base._host.EnableNextStep(this.chkAgreeLicence.Checked);
base.TipMessage = this.chkAgreeLicence.Checked ? string.Empty : "提示:在下一步前,您需要阅读并且同意用户协议!";
}
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)
{
Imps.Client.Core.Provisioning.OnCertPicRecived -= this._certPicRecivedHandler;
}
if (this._certSmsRequestSenedHandler != null)
{
Imps.Client.Core.Provisioning.OnSmsCertCodeRequestSended -= this._certSmsRequestSenedHandler;
}
if (this._svcAgreementRecivedHandler != null)
{
Imps.Client.Core.Provisioning.OnAgreementRecived -= this._svcAgreementRecivedHandler;
}
}
protected override void DisableAllControls()
{
this.txtMobileNo.Enabled = false;
this.txtValiCode.Enabled = false;
this.txtLicence.Enabled = false;
this.chkAgreeLicence.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.ProvsionData.MobileNo = mobileNo.ToString();
base._host.ProvsionData.CertPicCode = this.txtValiCode.Text;
return true;
}
return false;
}
private void Init()
{
ControlHelper.SetAcceptDigitOnly(this.txtMobileNo, true);
ControlHelper.ForceControlImeDisable(this.txtValiCode, true);
base._host.ProvsionData.ImgCertCode = null;
bool enable = base._host.ProvsionData.Flag.AgreementRecived && base._host.ProvsionData.Flag.CertPicRecived;
this.ShowFormIssue(enable);
this.ShowLawIssues(enable);
this.ShowLoading(!enable);
base._host.ProvsionData.Flag.CertPicRecived = false;
this.lbValiCodeTip.Text = "请稍候,正在获取图片验证码...";
this.txtValiCode.Enabled = false;
if (!string.IsNullOrEmpty(base._host.ProvsionData.Agreement))
{
this.txtLicence.Text = base._host.ProvsionData.Agreement;
}
}
private void InitializeComponent()
{
this.lbMobileNo = new XLabel();
this.lbValiCodeTip = new XLabel();
this.lbValiCode = new XLabel();
this.txtMobileNo = new XTextBox();
this.txtValiCode = new XTextBox();
this.pbValiCode = new PictureBox();
this.lbBName = new XLabel();
this.pbLoading = new PictureBox();
this.lbLoading = new XLabel();
this.lbSmsKtTip = new XLabel();
this.groupBox1 = new GroupBox();
this.groupBox2 = new GroupBox();
this.chkAgreeLicence = new CheckBox();
this.txtLicence = new XTextBox();
this.gbLicence = new GroupBox();
this.pbValiCode.BeginInit();
this.pbLoading.BeginInit();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.gbLicence.SuspendLayout();
base.SuspendLayout();
this.lbMobileNo.set_AutoSize(true);
this.lbMobileNo.BorderColor = Color.Empty;
this.lbMobileNo.ButtonBorderStyle = ButtonBorderStyle.None;
this.lbMobileNo.Font = new Font("宋体", 9f, FontStyle.Bold, GraphicsUnit.Point, 0x86);
this.lbMobileNo.Location = new Point(8, 0x15);
this.lbMobileNo.Name = "lbMobileNo";
this.lbMobileNo.Size = new Size(0x39, 12);
this.lbMobileNo.TabIndex = 2;
this.lbMobileNo.Text = "手机号:";
this.lbMobileNo.UseMnemonic = false;
this.lbValiCodeTip.set_AutoSize(true);
this.lbValiCodeTip.BorderColor = Color.Empty;
this.lbValiCodeTip.ButtonBorderStyle = ButtonBorderStyle.None;
this.lbValiCodeTip.Location = new Point(0x3b, 0x4b);
this.lbValiCodeTip.Name = "lbValiCodeTip";
this.lbValiCodeTip.Size = new Size(0x101, 12);
this.lbValiCodeTip.TabIndex = 6;
this.lbValiCodeTip.Text = "请输入上面右侧图片中的验证码(全部为数字)";
this.lbValiCodeTip.UseMnemonic = false;
this.lbValiCodeTip.Visible = false;
this.lbValiCode.set_AutoSize(true);
this.lbValiCode.BorderColor = Color.Empty;
this.lbValiCode.ButtonBorderStyle = ButtonBorderStyle.None;
this.lbValiCode.Font = new Font("宋体", 9f, FontStyle.Bold, GraphicsUnit.Point, 0x86);
this.lbValiCode.Location = new Point(8, 0x33);
this.lbValiCode.Name = "lbValiCode";
this.lbValiCode.Size = new Size(0x39, 12);
this.lbValiCode.TabIndex = 5;
this.lbValiCode.Text = "验证码:";
this.lbValiCode.UseMnemonic = false;
this.txtMobileNo.BackColor = Color.White;
this.txtMobileNo.BorderStyle = BorderStyle.FixedSingle;
this.txtMobileNo.EmptyTextTip = "请输入中国移动手机号码";
this.txtMobileNo.EmptyTextTipColor = Color.DarkGray;
this.txtMobileNo.Location = new Point(0x3d, 0x12);
this.txtMobileNo.MaxLength = 11;
this.txtMobileNo.Name = "txtMobileNo";
this.txtMobileNo.Size = new Size(0x9b, 0x15);
this.txtMobileNo.TabIndex = 0;
this.txtMobileNo.TextChanged += new EventHandler(this.txtMobileNo_TextChanged);
this.txtValiCode.BackColor = Color.White;
this.txtValiCode.BorderStyle = BorderStyle.FixedSingle;
this.txtValiCode.EmptyTextTip = "请输入图片中的验证数字";
this.txtValiCode.EmptyTextTipColor = Color.DarkGray;
this.txtValiCode.Location = new Point(0x3d, 0x2f);
this.txtValiCode.MaxLength = 8;
this.txtValiCode.Name = "txtValiCode";
this.txtValiCode.Size = new Size(0x9b, 0x15);
this.txtValiCode.TabIndex = 1;
this.pbValiCode.set_ErrorImage(null);
this.pbValiCode.set_InitialImage(null);
this.pbValiCode.Location = new Point(0xde, 0x2f);
this.pbValiCode.Name = "pbValiCode";
this.pbValiCode.Size = new Size(110, 0x15);
this.pbValiCode.SizeMode = PictureBoxSizeMode.AutoSize;
this.pbValiCode.TabIndex = 7;
this.pbValiCode.TabStop = false;
this.lbBName.set_AutoSize(true);
this.lbBName.BorderColor = Color.Empty;
this.lbBName.ButtonBorderStyle = ButtonBorderStyle.None;
this.lbBName.Location = new Point(0x41, 0xb1);
this.lbBName.Name = "lbBName";
this.lbBName.Size = new Size(0, 12);
this.lbBName.TabIndex = 15;
this.lbBName.UseMnemonic = false;
this.pbLoading.set_ErrorImage(null);
this.pbLoading.set_InitialImage(null);
this.pbLoading.Location = new Point(15, 0x7a);
this.pbLoading.Name = "pbLoading";
this.pbLoading.Size = new Size(40, 0x2d);
this.pbLoading.TabIndex = 0x10;
this.pbLoading.TabStop = false;
this.lbLoading.BorderColor = Color.Empty;
this.lbLoading.ButtonBorderStyle = ButtonBorderStyle.None;
this.lbLoading.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0x86);
this.lbLoading.ImageAlign = ContentAlignment.TopLeft;
this.lbLoading.Location = new Point(60, 0x7a);
this.lbLoading.Name = "lbLoading";
this.lbLoading.Size = new Size(0x114, 0x2d);
this.lbLoading.TabIndex = 0x11;
this.lbLoading.Text = "正在通过网络获取图形验证码,请稍候!";
this.lbLoading.UseMnemonic = false;
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(0x151, 0x19);
this.lbSmsKtTip.TabIndex = 0x12;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -