⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 licencepage.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 3 页
字号:
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 XComboBox cbSubComs;
        private CheckBox chkAgreeLicence;
        private IContainer components;
        private XLabel label1;
        private XLabel label2;
        private XLabel label3;
        private XLabel label4;
        private XLabel lbA;
        private XLabel lbB;
        private XLabel lbBName;
        private XLabel lbLicence;
        private XLabel lbLoading;
        private XLabel lblSeperate;
        private XLabel lbMobileNo;
        private XLabel lbMobileNoTip;
        private XLabel lbSmsKtTip;
        private XLabel lbValiCode;
        private XLabel lbValiCodeTip;
        private XLabel lbYourMobileNo;
        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.Shown += this._showHandler;
            base.Load += new EventHandler(this.LicencePage_Load);
            this._certPicRecivedHandler = new EventHandler<CertPicEventArgs>(this.Provisioning_OnCertPicRecived);
            Imps.Client.Core.Provisioning.OnCertPicRecived += this._certPicRecivedHandler;
            this._certSmsRequestSenedHandler = new EventHandler<CertSmsEventArgs>(this.Provisioning_OnSmsCertCodeRequestSended);
            Imps.Client.Core.Provisioning.OnSmsCertCodeRequestSended += this._certSmsRequestSenedHandler;
            this._svcAgreementRecivedHandler = new EventHandler<AgreementEventArgs>(this.Provisioning_OnAgreementRecived);
            Imps.Client.Core.Provisioning.OnAgreementRecived += this._svcAgreementRecivedHandler;
            this._sysCfgAvaildHanlder = new EventHandler<SysCfgEventArgs>(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)
            {
                long mobileNo = 0L;
                if (!ImpsHelper.TryParseMobileNo(this.txtMobileNo.Text, out mobileNo))
                {
                    BalloonHelper.ShowBallon(this.txtMobileNo, "请输入中国移动的手机号码!", "错误!", ToolTipIcon.Error, 0x5dc);
                    this.txtMobileNo.SelectAll();
                    this.txtMobileNo.Focus();
                    return false;
                }
                if (!StringHelper.IsAscii(this.txtMobileNo.Text))
                {
                    BalloonHelper.ShowBallon(this.txtMobileNo, StringTable.MsgAsciiOnly, "请注意", ToolTipIcon.Info, 0x5dc);
                    return false;
                }
            }
            else
            {
                BalloonHelper.ShowBallon(this.txtMobileNo, "您尚未填写手机号码!", "错误!", ToolTipIcon.Error, 0x5dc);
                this.txtMobileNo.Focus();
                return false;
            }
            if (this.txtValiCode.Text.Length == 0)
            {
                BalloonHelper.ShowBallon(this.txtValiCode, "您尚未填写验证码!", "错误!", ToolTipIcon.Error, 0x5dc);
                this.txtValiCode.Focus();
                return false;
            }
            if (!StringHelper.IsAscii(this.txtValiCode.Text))
            {
                BalloonHelper.ShowBallon(this.txtValiCode, StringTable.MsgAsciiOnly, "请注意", ToolTipIcon.Info, 0x5dc);
                return false;
            }
            if (this.cbSubComs.SelectedIndex == 0)
            {
                BalloonHelper.ShowBallon(this.cbSubComs, "您尚未选择您手机号码所属省份的移动分公司!", "错误!", ToolTipIcon.Error, 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.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;
            this.cbSubComs.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 = 0L;
                ImpsHelper.TryParseMobileNo(this.txtMobileNo.Text, out mobileNo);
                base._host.ProvsionData.MobileNo = mobileNo.ToString();
                base._host.ProvsionData.CertPicCode = this.txtValiCode.Text;
                base._host.ProvsionData.ProvinceIndex = this.cbSubComs.SelectedIndex;
                return true;
            }
            return false;
        }

        private void Init()
        {
            this.cbSubComs.Visible = false;
            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.lblSeperate = new XLabel();
            this.label1 = new XLabel();
            this.txtLicence = new XTextBox();
            this.lbMobileNo = new XLabel();
            this.lbMobileNoTip = new XLabel();
            this.lbValiCodeTip = new XLabel();
            this.lbValiCode = new XLabel();
            this.txtMobileNo = new XTextBox();
            this.txtValiCode = new XTextBox();
            this.pbValiCode = new PictureBox();
            this.lbYourMobileNo = new XLabel();
            this.lbLicence = new XLabel();
            this.chkAgreeLicence = new CheckBox();
            this.lbA = new XLabel();
            this.cbSubComs = new XComboBox();
            this.lbB = new XLabel();
            this.lbBName = new XLabel();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -