📄 licencepage.cs
字号:
this.lbSmsKtTip.Text = "您可以发送短信“{0}”到{1}开通绑定该手机的飞信业务,资费请咨询当地10086!";
this.lbSmsKtTip.UseMnemonic = false;
this.groupBox1.Controls.Add(this.lbSmsKtTip);
this.groupBox1.Dock = DockStyle.Bottom;
this.groupBox1.Location = new Point(0, 0x106);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new Size(0x189, 0x36);
this.groupBox1.TabIndex = 0x16;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "短信开通";
this.groupBox2.Controls.Add(this.pbValiCode);
this.groupBox2.Controls.Add(this.txtMobileNo);
this.groupBox2.Controls.Add(this.txtValiCode);
this.groupBox2.Controls.Add(this.lbMobileNo);
this.groupBox2.Controls.Add(this.lbValiCodeTip);
this.groupBox2.Controls.Add(this.lbValiCode);
this.groupBox2.Dock = DockStyle.Top;
this.groupBox2.Location = new Point(0, 0);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new Size(0x189, 0x4a);
this.groupBox2.TabIndex = 0x18;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "飞信客户端开通(推荐)";
this.chkAgreeLicence.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
this.chkAgreeLicence.set_AutoSize(true);
this.chkAgreeLicence.Location = new Point(6, 0x94);
this.chkAgreeLicence.Name = "chkAgreeLicence";
this.chkAgreeLicence.Size = new Size(0x60, 0x10);
this.chkAgreeLicence.TabIndex = 4;
this.chkAgreeLicence.Text = "同意上述内容";
this.chkAgreeLicence.set_UseVisualStyleBackColor(true);
this.chkAgreeLicence.CheckStateChanged += new EventHandler(this.chkAgreeLicence_CheckStateChanged);
this.txtLicence.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
this.txtLicence.BackColor = Color.FromArgb(240, 240, 240);
this.txtLicence.BorderStyle = BorderStyle.None;
this.txtLicence.EmptyTextTip = "";
this.txtLicence.EmptyTextTipColor = Color.DarkGray;
this.txtLicence.ImeMode = ImeMode.Disable;
this.txtLicence.Location = new Point(6, 0x12);
this.txtLicence.Multiline = true;
this.txtLicence.Name = "txtLicence";
this.txtLicence.ReadOnly = true;
this.txtLicence.ScrollBars = ScrollBars.Vertical;
this.txtLicence.Size = new Size(0x174, 0x7c);
this.txtLicence.TabIndex = 3;
this.gbLicence.Controls.Add(this.txtLicence);
this.gbLicence.Controls.Add(this.chkAgreeLicence);
this.gbLicence.Dock = DockStyle.Fill;
this.gbLicence.Location = new Point(0, 0x4a);
this.gbLicence.Name = "gbLicence";
this.gbLicence.Size = new Size(0x189, 0xbc);
this.gbLicence.TabIndex = 0x19;
this.gbLicence.TabStop = false;
this.gbLicence.Text = "用户协议";
base.set_AutoScaleDimensions(new SizeF(6f, 12f));
base.Controls.Add(this.gbLicence);
base.Controls.Add(this.groupBox2);
base.Controls.Add(this.groupBox1);
base.Controls.Add(this.lbLoading);
base.Controls.Add(this.pbLoading);
base.Controls.Add(this.lbBName);
base.Name = "LicencePage";
base.Size = new Size(0x189, 0x13c);
this.pbValiCode.EndInit();
this.pbLoading.EndInit();
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.gbLicence.ResumeLayout(false);
this.gbLicence.PerformLayout();
base.ResumeLayout(false);
base.PerformLayout();
}
private void LicencePage_Disposed(object sender, EventArgs e)
{
this.DetachEventHandler();
}
private void LicencePage_Load(object sender, EventArgs e)
{
this.txtMobileNo.Text = base._host.ProvsionData.MobileNo;
this.txtValiCode.Text = string.Empty;
if (!string.IsNullOrEmpty(base._host.ProvsionData.Agreement))
{
this.txtLicence.Text = base._host.ProvsionData.Agreement;
}
this.chkAgreeLicence.Checked = base._host.ProvsionData.Flag.SmsRequestSended;
if (!base._host.ProvsionData.Flag.SysCfgInited)
{
base._host.LoadSysCfg();
}
else
{
Imps.Client.Core.Provisioning.GetCertPic(base._host.ProvsionData);
if (string.IsNullOrEmpty(base._host.ProvsionData.Agreement))
{
Imps.Client.Core.Provisioning.GetAgreement(base._host.ProvsionData);
}
}
}
private void LoadResource()
{
if (base._host.ProvsionData.ImgCertCode != null)
{
this.pbValiCode.Image = base._host.ProvsionData.ImgCertCode;
}
this.lbSmsKtTip.Text = string.Format(this.lbSmsKtTip.Text, Imps.Client.Core.FixedClientSetting.Instance.KTSmsCode, Imps.Client.Core.FixedClientSetting.Instance.SmsNo);
}
public override void MoveToNextStage()
{
if (!base._host.ProvsionData.Flag.SysCfgInited || !base._host.ProvsionData.Flag.CertPicRecived)
{
BalloonHelper.ShowBallon(this.pbValiCode, "没有成功获取图形验证码!", "错误", 3, 0x3e8);
}
else if (this.GetValidData())
{
Imps.Client.Core.Provisioning.GetSmsCertCode(base._host.ProvsionData);
if (!base._host.smsTimer.Enabled)
{
base._host.smsTimer.Enabled = true;
}
base._host.canSendSmsRequest = false;
base._host.smsTickCounter = 0;
this.DisableAllControls();
}
}
private void Provisioning_OnAgreementRecived(object sender, AgreementEventArgs e)
{
if (string.IsNullOrEmpty(e.ErrorMessage))
{
if (!string.IsNullOrEmpty(e.Agreement))
{
base._host.ProvsionData.Agreement = e.Agreement;
base._host.ProvsionData.Flag.AgreementRecived = true;
this.txtLicence.Text = e.Agreement;
this.RespCounter++;
}
else
{
this.ShowLoadError(0x44e, e);
}
}
else
{
this.ShowLoadError(0x44e, e);
}
}
private void Provisioning_OnCertPicRecived(object sender, CertPicEventArgs e)
{
if (string.IsNullOrEmpty(e.ErrorMessage))
{
if ((e.CertPic != null) && (e.SessionID.Length > 0))
{
base._host.ProvsionData.PicCertSessionId = e.SessionID;
this.pbValiCode.Image = e.CertPic;
base._host.ProvsionData.ImgCertCode = e.CertPic;
base._host.ProvsionData.Flag.CertPicRecived = true;
this.lbValiCodeTip.Text = "请输入上面右侧图片中的验证码(全部为数字)";
this.txtValiCode.Enabled = true;
this.RespCounter++;
}
else
{
if (!string.IsNullOrEmpty(base._host.ProvsionData.Agreement))
{
BalloonHelper.ShowBallon(this.pbValiCode, string.Format("无法获取图形验证码,错误码:{0}", ProvisionBizCode.GetErrorCode(0x44d, e.WebException)), "错误", 3, 0x3e8);
}
this.ShowLoadError(0x44d, e);
}
}
else
{
if (!string.IsNullOrEmpty(base._host.ProvsionData.Agreement))
{
BalloonHelper.ShowBallon(this.pbValiCode, string.Format("无法获取图形验证码,错误码:{0}", ProvisionBizCode.GetErrorCode(0x44d, e.WebException)), "错误", 3, 0x3e8);
}
this.ShowLoadError(0x44d, e);
}
}
private void Provisioning_OnSmsCertCodeRequestSended(object sender, CertSmsEventArgs e)
{
if (!string.IsNullOrEmpty(e.ErrorMessage))
{
if (e.HttpStautsCode == 400)
{
this.txtValiCode.SelectAll();
this.pbValiCode.Image = null;
Imps.Client.Core.Provisioning.GetCertPic(base._host.ProvsionData);
this.txtValiCode.Enabled = false;
this.lbValiCodeTip.Text = "请稍候,正在获取图片验证码...";
this.txtValiCode.Enabled = false;
}
else if (e.HttpStautsCode == 0x1a7)
{
e.ErrorMessage = string.Format("对不起,您重试次数太多,请稍候再试!错误码:{0}", ProvisionBizCode.GetErrorCode(0x44f, e.WebException));
}
this.RestoreAllControlsStatus();
base._host.canSendSmsRequest = true;
}
else
{
base._host.ProvsionData.Flag.SmsRequestSended = true;
}
base._host.EnableNextStep(this.chkAgreeLicence.Checked);
base.FireMoveNextEvent(this, e);
}
protected override void RestoreAllControlsStatus()
{
this.txtMobileNo.Enabled = true;
this.txtValiCode.Enabled = true;
this.txtLicence.Enabled = true;
this.chkAgreeLicence.Enabled = true;
base._host.SetButtonStatus(this);
}
private void ShowFormIssue(bool enable)
{
this.lbValiCodeTip.Visible = enable;
this.txtValiCode.Enabled = enable;
}
private void ShowLawIssues(bool enable)
{
this.gbLicence.Visible = enable;
this.chkAgreeLicence.Visible = enable;
this.lbBName.Visible = enable;
if (enable && !this.chkAgreeLicence.Checked)
{
base.TipMessage = "提示:在下一步前,您需要阅读并且同意用户协议!";
}
}
private void ShowLoadError(int bizCode, HttpAppEventArgs e)
{
this.pbLoading.Image = ImpsResources.GetImage("Images.cancel.png");
string text = "错误:获取";
if (!base._host.ProvsionData.Flag.CertPicRecived)
{
text = text + "图形验证码";
if (!base._host.ProvsionData.Flag.AgreementRecived)
{
text = text + "和用户协议内容";
}
}
else if (!base._host.ProvsionData.Flag.AgreementRecived)
{
text = text + "用户协议内容";
}
if (e == null)
{
text = text + "失败!";
}
else if (e.WebException == null)
{
text = text + "失败!";
}
else
{
text = string.Format(text + "失败,错误码:{0}。", ProvisionBizCode.GetErrorCode(bizCode, e.WebException));
}
this.lbLoading.Text = text;
}
private void ShowLoading(bool p)
{
this.pbLoading.Visible = p;
this.lbLoading.Visible = p;
}
private void txtMobileNo_TextChanged(object sender, EventArgs e)
{
this.lbBName.Text = string.Format("(移动电话号码:{0})", this.txtMobileNo.Text);
}
public override bool CanMoveNext
{
get
{
return base._host.ProvsionData.Flag.SmsRequestSended;
}
}
public override bool CanMovePrivious
{
get
{
return false;
}
}
public override ProvsionStage NextStage
{
get
{
return ProvsionStage.Password;
}
}
private int RespCounter
{
get
{
return this.respCounter;
}
set
{
if (value == 2)
{
this.ShowFormIssue(true);
this.ShowLawIssues(true);
this.ShowLoading(false);
}
this.respCounter = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -