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

📄 passwordpage.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 2 页
字号:
namespace Imps.Client.Pc.Password
{
    using Imps.Client.Core;
    using Imps.Client.Core.Password;
    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 : StepPageBase
    {
        private bool _canMoveNext;
        private EventHandler<CertSmsEventArgs> _certSmsRequestSenedHandler;
        private EventHandler _hostSmsTimerTick;
        private EventHandler<HttpAppEventArgs> _submitEventHandler;
        private IContainer components;
        private XLabel label1;
        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(SetPasswordWizard host) : base(host)
        {
            this._canMoveNext = true;
            this.InitializeComponent();
            this.LoadResource();
            this.AttachEventHandler();
            base.Disposed += new EventHandler(this.PasswordPage_Disposed);
            this.Init();
        }

        private void AttachEventHandler()
        {
            this._certSmsRequestSenedHandler = new EventHandler<CertSmsEventArgs>(this.Password_OnSmsCertCodeRequestSended);
            ModifyPassword.OnSmsCertCodeRequestSended += this._certSmsRequestSenedHandler;
            this._submitEventHandler = new EventHandler<HttpAppEventArgs>(this.Password_OnSubmit);
            ModifyPassword.OnSubmit += this._submitEventHandler;
            this._hostSmsTimerTick = new EventHandler(this.smsTimer_Tick);
            base._host.smsTimer.Tick += this._hostSmsTimerTick;
        }

        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)
            {
                ModifyPassword.OnSmsCertCodeRequestSended -= this._certSmsRequestSenedHandler;
            }
            if (this._submitEventHandler != null)
            {
                ModifyPassword.OnSubmit -= this._submitEventHandler;
            }
        }

        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.passwordData.SmsValiCode = this.txtSmsValiCode.Text;
                base._host.passwordData.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.passwordData.MobileNo);
            this.lbPasswordTip.Text = StringTable.Password.PasswordRules;
            ControlHelper.SetAcceptPasswordChar(this.txtPassword);
            ControlHelper.SetAcceptPasswordChar(this.txtRePassword);
            ControlHelper.ForceControlImeDisable(this.txtSmsValiCode, true);
        }

        private void InitializeComponent()
        {
            this.lbWord = new XLabel();
            this.lbPasswordTip = new XLabel();
            this.lnkRegetSmsValiCode = new LinkLabel();
            this.lbSmsValiCode = new XLabel();
            this.label1 = new XLabel();
            this.lbPasswordSection = new XLabel();
            this.lblSeperate = new XLabel();
            this.txtRePassword = new XTextBox();
            this.txtPassword = new XTextBox();
            this.lbRePassword = new XLabel();
            this.lbPass = new XLabel();
            this.lbSmsValiCodeNotice = new XLabel();
            this.txtSmsValiCode = new XTextBox();
            this.lbIDTips = new XLabel();
            this.lbValiCodeTip = new XLabel();
            base.SuspendLayout();
            this.lbWord.AutoSize = true;
            this.lbWord.BorderColor = Color.Empty;
            this.lbWord.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lbWord.Location = new Point(0x38, 0xa5);
            this.lbWord.Name = "lbWord";
            this.lbWord.Size = new Size(0x13, 13);
            this.lbWord.TabIndex = 0x22;
            this.lbWord.Text = "码";
            this.lbWord.UseMnemonic = false;
            this.lbPasswordTip.BorderColor = Color.Empty;
            this.lbPasswordTip.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lbPasswordTip.Location = new Point(20, 0xd6);
            this.lbPasswordTip.Name = "lbPasswordTip";
            this.lbPasswordTip.Size = new Size(0x16c, 0x2f);
            this.lbPasswordTip.TabIndex = 0x1f;
            this.lbPasswordTip.Text = "lbPasswordTip";
            this.lbPasswordTip.UseMnemonic = false;
            this.lnkRegetSmsValiCode.AutoSize = true;
            this.lnkRegetSmsValiCode.Location = new Point(0xc6, 0x6c);
            this.lnkRegetSmsValiCode.Name = "lnkRegetSmsValiCode";
            this.lnkRegetSmsValiCode.Size = new Size(0x67, 13);
            this.lnkRegetSmsValiCode.TabIndex = 0x18;
            this.lnkRegetSmsValiCode.TabStop = true;
            this.lnkRegetSmsValiCode.Text = "请点击这里重试!";
            this.lnkRegetSmsValiCode.LinkClicked += new LinkLabelLinkClickedEventHandler(this.lnkRegetSmsValiCode_LinkClicked);
            this.lbSmsValiCode.AutoSize = true;
            this.lbSmsValiCode.BorderColor = Color.Empty;
            this.lbSmsValiCode.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lbSmsValiCode.Location = new Point(3, 0);
            this.lbSmsValiCode.Name = "lbSmsValiCode";
            this.lbSmsValiCode.Size = new Size(0x43, 13);
            this.lbSmsValiCode.TabIndex = 0x12;
            this.lbSmsValiCode.Text = "短信验证码";
            this.lbSmsValiCode.UseMnemonic = false;
            this.label1.BorderColor = Color.Empty;
            this.label1.BorderStyle = BorderStyle.Fixed3D;
            this.label1.ButtonBorderStyle = ButtonBorderStyle.None;
            this.label1.Location = new Point(0x4d, 5);
            this.label1.Name = "label1";
            this.label1.Size = new Size(330, 2);
            this.label1.TabIndex = 0x13;
            this.label1.UseMnemonic = false;
            this.lbPasswordSection.AutoSize = true;
            this.lbPasswordSection.BorderColor = Color.Empty;
            this.lbPasswordSection.ButtonBorderStyle = ButtonBorderStyle.None;
            this.lbPasswordSection.Location = new Point(3, 0x8e);
            this.lbPasswordSection.Name = "lbPasswordSection";

⌨️ 快捷键说明

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