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

📄 mobilephonepage.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 2 页
字号:
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 XLabel label1;
        private XLabel lbLoading;
        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 XTextBox txtMobileNo;
        private XTextBox txtValiCode;

        public MobilePhonePage(SetPasswordWizard host) : base(host)
        {
            this._vscroll = scroll_maker.instance.vscroll();
            this.InitializeComponent();
            string str = (string.Format(StringTable.User.MsgForgetPass, Imps.Client.Core.FixedClientSetting.Instance.ChangePasswordNo) + "\r\n\r\n" + StringTable.Password.PasswordRules) + "\r\n\r\n您也可以输入手机号和附加码,系统将发送短信确认码到您的手机,您正确输入该短信确认码后可以进行密码重置";
            this.lbSmsKtTip.Text = str;
            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.Shown += this._showHandler;
            base.Load += new EventHandler(this.MobilePhonePage_Load);
            this._certPicRecivedHandler = new EventHandler<CertPicEventArgs>(this.ModifyPassword_OnCertPicRecived);
            ModifyPassword.OnCertPicRecived += this._certPicRecivedHandler;
            this._certSmsRequestSenedHandler = new EventHandler<CertSmsEventArgs>(this.ModifyPassword_OnSmsCertCodeRequestSended);
            ModifyPassword.OnSmsCertCodeRequestSended += this._certSmsRequestSenedHandler;
            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;
            }
            return true;
        }

        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)
            {
                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 = 0L;
                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.lbValiCodeTip.Text = "请稍候,正在获取图片验证码……";
            this.txtValiCode.Enabled = false;
        }

        private void InitializeComponent()
        {
            this.lbSmsKtTip = new XLabel();
            this.lbLoading = new XLabel();
            this.pbLoading = new PictureBox();
            this.lbYourMobileNo = new XLabel();
            this.label1 = new XLabel();
            this.pbValiCode = new PictureBox();
            this.txtValiCode = new XTextBox();
            this.txtMobileNo = new XTextBox();
            this.lbValiCodeTip = new XLabel();
            this.lbValiCode = new XLabel();
            this.lbMobileNoTip = new XLabel();
            this.lbMobileNo = new XLabel();
            ((ISupportInitialize) this.pbLoading).BeginInit();
            ((ISupportInitialize) this.pbValiCode).BeginInit();
            base.SuspendLayout();
            this.lbSmsKtTip.BorderColor = Color.Empty;
            this.lbSmsKtTip.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lbSmsKtTip.Font = new Font("SimSun", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            this.lbSmsKtTip.Location = new Point(9, 12);
            this.lbSmsKtTip.Name = "lbSmsKtTip";
            this.lbSmsKtTip.Size = new Size(0x160, 0x7a);
            this.lbSmsKtTip.TabIndex = 0x29;
            this.lbSmsKtTip.UseMnemonic = 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.Location = new Point(0x31, 0xd5);
            this.lbLoading.Name = "lbLoading";
            this.lbLoading.Size = new Size(0x132, 40);
            this.lbLoading.TabIndex = 40;
            this.lbLoading.Text = "正在通过网络获取图形验证码,请稍候!";
            this.lbLoading.TextAlign = ContentAlignment.MiddleLeft;
            this.lbLoading.UseMnemonic = false;
            this.lbLoading.Visible = false;
            this.pbLoading.ErrorImage = null;
            this.pbLoading.InitialImage = null;
            this.pbLoading.Location = new Point(11, 0xdd);
            this.pbLoading.Name = "pbLoading";
            this.pbLoading.Size = new Size(0x20, 0x20);
            this.pbLoading.TabIndex = 0x27;
            this.pbLoading.TabStop = false;
            this.pbLoading.Visible = false;
            this.lbYourMobileNo.AutoSize = true;
            this.lbYourMobileNo.BorderColor = Color.Empty;
            this.lbYourMobileNo.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lbYourMobileNo.Location = new Point(8, 0x91);
            this.lbYourMobileNo.Name = "lbYourMobileNo";
            this.lbYourMobileNo.Size = new Size(0x8b, 13);
            this.lbYourMobileNo.TabIndex = 0x17;
            this.lbYourMobileNo.Text = "请输入手机号码和验证码";
            this.lbYourMobileNo.UseMnemonic = false;
            this.label1.BorderColor = Color.Empty;
            this.label1.BorderStyle = BorderStyle.Fixed3D;
            this.label1.ButtonBorderStyle = ButtonBorderStyle.None;
            this.label1.Location = new Point(90, 150);
            this.label1.Name = "label1";
            this.label1.Size = new Size(300, 2);
            this.label1.TabIndex = 0x18;
            this.label1.UseMnemonic = false;
            this.pbValiCode.ErrorImage = null;
            this.pbValiCode.InitialImage = null;
            this.pbValiCode.Location = new Point(0xc1, 0xc5);

⌨️ 快捷键说明

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