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

📄 passwordpage.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 2 页
字号:
namespace Imps.Client.Pc.Provsion2
{
    using Imps.Client.Core;
    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 PasswordPage : ProvsionControlBase
    {
        private bool _canMoveNext;
        private EventHandler<CertSmsEventArgs> _certSmsRequestSenedHandler;
        private EventHandler<FeeInfoEventArgs> _feeInfoRecivedHandler;
        private EventHandler _hostSmsTimerTick;
        private EventHandler<SubscribeEventArgs> _subScribeEventHandler;
        private IContainer components;
        private XLabel label1;
        private XLabel label2;
        private XLabel lbFee;
        private XLabel lbFeeInfo;
        private XLabel lbIDTips;
        private XLabel lblSeperate;
        private XLabel lbPass;
        private XLabel lbPasswordSection;
        private XLabel lbPasswordTip;
        private XLabel lbRePassword;
        private XLabel lbSmsValiCode;
        private XLabel lbSmsValiCodeNotice;
        private XLabel lbValiCodeTip;
        private XLabel lbWord;
        private LinkLabel lnkRegetSmsValiCode;
        private XTextBox txtPassword;
        private XTextBox txtRePassword;
        private XTextBox txtSmsValiCode;

        public PasswordPage(ProvisionWizard host) : base(host)
        {
            this.InitializeComponent();
            this.LoadResource();
            this.AttachEventHandler();
            base.Disposed += new EventHandler(this.PasswordPage_Disposed);
            this.Init();
        }

        private void AttachEventHandler()
        {
            this._certSmsRequestSenedHandler = new EventHandler<CertSmsEventArgs>(this.Provisioning_OnSmsCertCodeRequestSended);
            Imps.Client.Core.Provisioning.OnSmsCertCodeRequestSended += this._certSmsRequestSenedHandler;
            this._subScribeEventHandler = new EventHandler<SubscribeEventArgs>(this.Provisioning_OnSubscribe);
            Imps.Client.Core.Provisioning.OnSubscribe += this._subScribeEventHandler;
            this._hostSmsTimerTick = new EventHandler(this.smsTimer_Tick);
            base._host.smsTimer.Tick += this._hostSmsTimerTick;
            this._feeInfoRecivedHandler = new EventHandler<FeeInfoEventArgs>(this.Provisioning_OnFeeInformationRecived);
            Imps.Client.Core.Provisioning.OnFeeInformationRecived += this._feeInfoRecivedHandler;
        }

        private bool CheckData()
        {
            this.txtSmsValiCode.Text = this.txtSmsValiCode.Text.Trim();
            this.txtPassword.Text = this.txtPassword.Text.Trim();
            this.txtRePassword.Text = this.txtRePassword.Text.Trim();
            if (this.txtSmsValiCode.Text.Length == 0)
            {
                BalloonHelper.ShowBallon(this.txtSmsValiCode, "请填写短信验证码!", "错误!", ToolTipIcon.Error, 0x5dc);
                this.txtSmsValiCode.Focus();
                return false;
            }
            if (!StringHelper.IsAscii(this.txtSmsValiCode.Text))
            {
                BalloonHelper.ShowBallon(this.txtSmsValiCode, StringTable.MsgAsciiOnly, "请注意", ToolTipIcon.Info, 0x5dc);
                return false;
            }
            if (this.txtPassword.Text.Length > 0)
            {
                if (this.txtRePassword.Text.Length > 0)
                {
                    if (this.txtPassword.Text != this.txtRePassword.Text)
                    {
                        BalloonHelper.ShowBallon(this.txtRePassword, "您两次输入的密码不一致!", "错误!", ToolTipIcon.Error, 0x5dc);
                        this.txtRePassword.SelectAll();
                        this.txtRePassword.Focus();
                        return false;
                    }
                    if (ControlHelper.IsValidPassword(this.txtPassword.Text))
                    {
                        return true;
                    }
                    BalloonHelper.ShowBallon(this.txtRePassword, "密码不符合规则!", "错误!", ToolTipIcon.Error, 0x5dc);
                    this.txtPassword.SelectAll();
                    this.txtPassword.Focus();
                    return false;
                }
                BalloonHelper.ShowBallon(this.txtRePassword, "请再一次输入密码!", "错误!", ToolTipIcon.Error, 0x5dc);
                this.txtRePassword.Focus();
                return false;
            }
            BalloonHelper.ShowBallon(this.txtPassword, "请输入密码!", "错误!", ToolTipIcon.Error, 0x5dc);
            this.txtPassword.Focus();
            return false;
        }

        public override void DetachEventHandler()
        {
            if (this._hostSmsTimerTick != null)
            {
                base._host.smsTimer.Tick -= this._hostSmsTimerTick;
            }
            if (this._certSmsRequestSenedHandler != null)
            {
                Imps.Client.Core.Provisioning.OnSmsCertCodeRequestSended -= this._certSmsRequestSenedHandler;
            }
            if (this._subScribeEventHandler != null)
            {
                Imps.Client.Core.Provisioning.OnSubscribe -= this._subScribeEventHandler;
            }
            if (this._feeInfoRecivedHandler != null)
            {
                Imps.Client.Core.Provisioning.OnFeeInformationRecived -= this._feeInfoRecivedHandler;
            }
        }

        protected override void DisableAllControls()
        {
            this.txtSmsValiCode.Enabled = false;
            this.txtPassword.Enabled = false;
            this.txtRePassword.Enabled = false;
            this.lnkRegetSmsValiCode.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())
            {
                base._host.ProvsionData.SmsValiCode = this.txtSmsValiCode.Text;
                base._host.ProvsionData.Password = this.txtPassword.Text;
                return true;
            }
            return false;
        }

        private void Init()
        {
            base._tipMessage = string.Empty;
            this.lbValiCodeTip.Text = string.Format(this.lbValiCodeTip.Text, base._host.ProvsionData.MobileNo);
            this.lbPasswordTip.Text = StringTable.Password.PasswordRules;
            ControlHelper.SetAcceptPasswordChar(this.txtPassword);
            ControlHelper.SetAcceptPasswordChar(this.txtRePassword);
            ControlHelper.ForceControlImeDisable(this.txtSmsValiCode, true);
        }

        private void InitializeComponent()
        {
            this.lblSeperate = new XLabel();
            this.label1 = new XLabel();
            this.lbSmsValiCode = new XLabel();
            this.lbValiCodeTip = new XLabel();
            this.lbIDTips = new XLabel();
            this.txtSmsValiCode = new XTextBox();
            this.lbSmsValiCodeNotice = new XLabel();
            this.lbPasswordSection = new XLabel();
            this.lbPass = new XLabel();
            this.lbRePassword = new XLabel();
            this.txtPassword = new XTextBox();
            this.txtRePassword = new XTextBox();
            this.lnkRegetSmsValiCode = new LinkLabel();
            this.lbPasswordTip = new XLabel();
            this.lbFeeInfo = new XLabel();
            this.label2 = new XLabel();
            this.lbWord = new XLabel();
            this.lbFee = new XLabel();
            base.SuspendLayout();
            this.lblSeperate.BorderColor = Color.Empty;
            this.lblSeperate.BorderStyle = BorderStyle.Fixed3D;
            this.lblSeperate.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lblSeperate.Location = new Point(0x84, 0xea);
            this.lblSeperate.Name = "lblSeperate";
            this.lblSeperate.Size = new Size(320, 2);
            this.lblSeperate.TabIndex = 8;
            this.lblSeperate.UseMnemonic = false;
            this.label1.BorderColor = Color.Empty;
            this.label1.BorderStyle = BorderStyle.Fixed3D;
            this.label1.ButtonBorderStyle = ButtonBorderStyle.None;
            this.label1.Location = new Point(80, 12);
            this.label1.Name = "label1";
            this.label1.Size = new Size(330, 2);
            this.label1.TabIndex = 1;
            this.label1.UseMnemonic = false;
            this.lbSmsValiCode.AutoSize = true;
            this.lbSmsValiCode.BorderColor = Color.Empty;
            this.lbSmsValiCode.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lbSmsValiCode.Location = new Point(6, 7);
            this.lbSmsValiCode.Name = "lbSmsValiCode";
            this.lbSmsValiCode.Size = new Size(0x43, 13);
            this.lbSmsValiCode.TabIndex = 0;
            this.lbSmsValiCode.Text = "短信验证码";
            this.lbSmsValiCode.UseMnemonic = false;
            this.lbValiCodeTip.BorderColor = Color.Empty;
            this.lbValiCodeTip.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lbValiCodeTip.Location = new Point(0x11, 0x1c);
            this.lbValiCodeTip.Name = "lbValiCodeTip";
            this.lbValiCodeTip.Size = new Size(0x142, 0x2a);
            this.lbValiCodeTip.TabIndex = 2;
            this.lbValiCodeTip.Text = "已通过短信方式发送验证码到您的手机[ {0} ]上,请注意查收。请在下面的输入框中输入您收到的验证码,以鉴别您的身份:";
            this.lbValiCodeTip.UseMnemonic = false;
            this.lbIDTips.AutoSize = true;
            this.lbIDTips.BorderColor = Color.Empty;
            this.lbIDTips.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lbIDTips.Location = new Point(0x11, 0x34);
            this.lbIDTips.Name = "lbIDTips";
            this.lbIDTips.Size = new Size(0, 13);
            this.lbIDTips.TabIndex = 3;
            this.lbIDTips.UseMnemonic = false;
            this.txtSmsValiCode.BackColor = Color.White;
            this.txtSmsValiCode.BorderStyle = BorderStyle.FixedSingle;
            this.txtSmsValiCode.Location = new Point(0x49, 0x4c);
            this.txtSmsValiCode.MaxLength = 8;
            this.txtSmsValiCode.Name = "txtSmsValiCode";
            this.txtSmsValiCode.Size = new Size(0xd8, 20);
            this.txtSmsValiCode.TabIndex = 4;
            this.lbSmsValiCodeNotice.BorderColor = Color.Empty;
            this.lbSmsValiCodeNotice.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lbSmsValiCodeNotice.Location = new Point(0x13, 0x66);
            this.lbSmsValiCodeNotice.Name = "lbSmsValiCodeNotice";
            this.lbSmsValiCodeNotice.Size = new Size(0x14f, 0x2f);
            this.lbSmsValiCodeNotice.TabIndex = 5;
            this.lbSmsValiCodeNotice.Text = "注意:短信可能由于网络等原因有一些延迟,请稍等。\r\n如果您在一分钟内没有收到短信,\r\n请勿连续重试!";
            this.lbSmsValiCodeNotice.UseMnemonic = false;
            this.lbPasswordSection.AutoSize = true;
            this.lbPasswordSection.BorderColor = Color.Empty;
            this.lbPasswordSection.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lbPasswordSection.Location = new Point(6, 0xe4);
            this.lbPasswordSection.Name = "lbPasswordSection";
            this.lbPasswordSection.Size = new Size(120, 13);
            this.lbPasswordSection.TabIndex = 7;
            this.lbPasswordSection.Text = "请设置您的Fetion密码";
            this.lbPasswordSection.UseMnemonic = false;
            this.lbPass.AutoSize = true;
            this.lbPass.BorderColor = Color.Empty;
            this.lbPass.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lbPass.Location = new Point(0x17, 0xfb);
            this.lbPass.Name = "lbPass";
            this.lbPass.Size = new Size(0x13, 13);
            this.lbPass.TabIndex = 9;
            this.lbPass.Text = "密";
            this.lbPass.UseMnemonic = false;
            this.lbRePassword.AutoSize = true;
            this.lbRePassword.BorderColor = Color.Empty;
            this.lbRePassword.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lbRePassword.Location = new Point(0x17, 0x114);
            this.lbRePassword.Name = "lbRePassword";
            this.lbRePassword.Size = new Size(0x37, 13);
            this.lbRePassword.TabIndex = 11;
            this.lbRePassword.Text = "确认密码";
            this.lbRePassword.UseMnemonic = false;
            this.txtPassword.BackColor = Color.White;
            this.txtPassword.BorderStyle = BorderStyle.FixedSingle;
            this.txtPassword.Location = new Point(0x56, 0xf7);
            this.txtPassword.MaxLength = 0x10;
            this.txtPassword.Name = "txtPassword";
            this.txtPassword.PasswordChar = '*';
            this.txtPassword.Size = new Size(0xaf, 20);

⌨️ 快捷键说明

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