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

📄 entrypointcontrol.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 5 页
字号:
namespace Imps.Client.Pc
{
    using Imps.Client;
    using Imps.Client.Core;
    using Imps.Client.Pc.BizControls;
    using Imps.Client.Pc.BizControls.NotifyWindows;
    using Imps.Client.Pc.Controls;
    using Imps.Client.Pc.Password;
    using Imps.Client.Pc.Properties;
    using Imps.Client.Pc.Utils;
    using Imps.Client.Pc.WndlessControls;
    using Imps.Client.Resource;
    using Imps.Client.Utils;
    using Imps.Common;
    using Imps.Utils;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Net.NetworkInformation;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;
    using System.Text;
    using System.Windows.Forms;

    internal class EntryPointControl : UserControl
    {
        private bool _causedByUser = true;
        private Image _curPortrait;
        private Image _defaultPortrait;
        private MainPresence _initPresence = MainPresence.Online;
        private UserAccountManager _manager;
        private bool _suspendIdChanged;
        private WndlessControlCollection _wndlessCtls;
        private AutoReconnect autoReconnect;
        private volatile bool AutoReconnectEventAttached;
        private BDisplayHelp bDisplayHelp;
        private XButton btnLogin;
        private CheckBox cbAutoLogin;
        private CheckBox cbSaveAccount;
        private CheckBox cbSavePassword;
        private XComboBox cmbId;
        private IContainer components;
        private UserAccounts.AccountData currentAd;
        private int HeightShowButton = 0x87;
        private int HeightShowPortrait = 0x13b;
        private int HeightShowSaveInfo = 0xeb;
        private BDisplayNameAndOnlineStatus InitStatus;
        private menu_widget InitStatusMenu;
        private WndlessLabel lblStep;
        private WndlessLabel lblWelcome;
        private WndlessLinkLabel llEraseInfo;
        private WndlessLinkLabel llForgetPass;
        private WndlessLinkLabel llNetSetting;
        private WndlessLinkLabel llProvisioning;
        private WndlessLinkLabel llReconnectAtOnce;
        private const int MarginX = 0x18;
        private const int MarginY = 50;
        private const int PaddingX = 5;
        private const int PaddingY = 3;
        private WndlessPictureBox pbPortrait;
        private PictureBox pbProgress;
        private WndlessPictureBox pnPortrait;
        private RadioButton rbPrivate;
        private RadioButton rbPublic;
        private const int SpacingLogin = 0x24;
        private XPasswordEdit tbPassword;
        private const int WidthMaxId = 160;
        private const int WidthMinId = 80;
        private int WidthShowProvisioning;

        public EntryPointControl(UserAccountManager manager)
        {
            this._manager = manager;
            this._manager.CurrentUser.StatusChanged += new EventHandler<UserSatusChangedEventArgs>(this, (IntPtr) this.CurrentUser_StatusChanged);
            this._manager.CurrentUser.LoginStepChanged += new EventHandler(this.CurrentUser_LoginStepChanged);
            this._manager.CurrentUser.AutoLoginFailed += new EventHandler<ImpsErrorEventArgs>(this, (IntPtr) this.CurrentUser_AutoLoginFailed);
            this._manager.FrameworkWnd.MainWindowLoaded += new EventHandler(this.FrameworkWnd_Loaded);
            this._manager.FrameworkWnd.MainWindow.Activated += new EventHandler(this.MainWindow_Activated);
            this._manager.FrameworkWnd.SuspendRestored += new EventHandler(this.FrameworkWnd_SuspendRestored);
            this._manager.FrameworkWnd.BeginSuspend += new EventHandler(this.FrameworkWnd_BeginSuspend);
            base.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
            this.set_DoubleBuffered(true);
            this.InitializeComponent();
            this.cmbId.EmptyTextTip = "请输入手机号或飞信号...";
            this.tbPassword.EmptyTextTip = StringTable.Password.EmptyPasswordTipText;
            this.tbPassword.ModifyPasswordTip = StringTable.Password.ModifyPasswordTipOfPasswordEdit;
            this.InitializeWndlessComponent();
            this.tbPassword.DoEncrypt = new XPasswordEdit.DlgtEncryptString(this._manager.CurrentUser.HashPassword);
            this.CalcSizeParameters();
            base.SizeChanged += new EventHandler(this.EntryPointControl_SizeChanged);
            ControlHelper.SetAcceptDigitOnly(this.cmbId, true);
            this.DoLocalize();
            this.ResetCheckBox();
            this.InitStatusMenuItems();
            this.bDisplayHelp.DropDownMenu = ((MainForm) this._manager.FrameworkWnd).HelpMenu;
            this.autoReconnect = new AutoReconnect(0x7fffffff);
            this.AttachReconnEventHandlers(true);
        }

        private void AR_OnTick(object sender, TickEventArgs e)
        {
            try
            {
                this._manager.CurrentUser.Status = UserAccountStatus.WaitReconnect;
                if (NetworkInterface.GetIsNetworkAvailable())
                {
                    this.llReconnectAtOnce.Visible = true;
                    if (e != null)
                    {
                        this.UpdateStepLabelText(string.Format(StringTable.User.StepNextReconnect, e.CurrentTick));
                    }
                }
                else
                {
                    this.llReconnectAtOnce.Visible = false;
                    this.UpdateStepLabelText(StringTable.User.WaitForNetworkRecover);
                    this.autoReconnect.StopTimer();
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        private void AR_TimeUp(object sender, EventArgs e)
        {
            try
            {
                if (this._manager.CurrentUser.Status == UserAccountStatus.WaitReconnect)
                {
                    if (NetworkInterface.GetIsNetworkAvailable())
                    {
                        this.UpdateStepLabelText(StringTable.User.StepSigning);
                        this.autoReconnect.StopTimer();
                        this._manager.CurrentUser.AsyncLogin(this._initPresence, true);
                    }
                    else
                    {
                        this.llReconnectAtOnce.Visible = false;
                        this.UpdateStepLabelText(StringTable.User.WaitForNetworkRecover);
                        this.autoReconnect.StopTimer();
                    }
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        private void AttachReconnEventHandlers(bool attach)
        {
            if (attach)
            {
                if (!this.AutoReconnectEventAttached)
                {
                    this.autoReconnect.OnTick += new EventHandler<TickEventArgs>(this, (IntPtr) this.AR_OnTick);
                    this.autoReconnect.TimeUp += new EventHandler(this.AR_TimeUp);
                }
            }
            else
            {
                this.AutoReconnectEventAttached = false;
                this.autoReconnect.OnTick -= new EventHandler<TickEventArgs>(this, (IntPtr) this.AR_OnTick);
                this.autoReconnect.TimeUp -= new EventHandler(this.AR_TimeUp);
            }
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (base.Visible)
                {
                    this.DoLoginOrCancel();
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteGeneral(exception.ToString());
            }
        }

        private void CalcSizeParameters()
        {
            this.HeightShowButton = 200;
            this.HeightShowSaveInfo = ((this.HeightShowButton + (this.cbSaveAccount.Height * 4)) + 30) + 9;
            this.HeightShowPortrait = (this.HeightShowSaveInfo + this.pnPortrait.Height) + 20;
            this.WidthShowProvisioning = (((80 + this.WidthMaxProvisioning) + 0x18) + 0x18) + 5;
        }

        internal void CancelLogin()
        {
            try
            {
                this.UpdateStepLabelText("取消中...");
            }
            catch
            {
            }
            try
            {
                this.autoReconnect.StopTimer(true);
                this._manager.CurrentUser.AsyncCancelLogin();
                this._suspendIdChanged = false;
                this.cmbId.SelectAll();
                this.cmbId.Focus();
            }
            catch (Exception exception)
            {
                this._manager.FrameworkWnd.UnifiedMessageBox.ShowException(exception);
            }
        }

        private void cbAutoLogin_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (this.cbAutoLogin.Checked)
                {
                    this.cbSaveAccount.Checked = true;
                    this.cbSavePassword.Checked = true;
                }
                if (this._causedByUser)
                {
                    UserAccounts.SetAccountAutoLogin(this.cmbId.Text, this.cbAutoLogin.Checked);
                    UserAccounts.SaveToLocal();
                }
            }
            catch (Exception exception)
            {
                UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception);
            }
        }

        private void cbSaveAccount_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (!this.cbSaveAccount.Checked)
                {
                    this._causedByUser = false;
                    this.cbAutoLogin.Checked = false;
                    this.cbSavePassword.Checked = false;
                    this._causedByUser = true;
                }
            }
            catch
            {
            }
        }

        private void cbSavePassword_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (this.cbSavePassword.Checked)
                {
                    this.cbSaveAccount.Checked = true;
                }
                else
                {
                    this.cbAutoLogin.Checked = false;
                    this.tbPassword.Enabled = true;
                    if (this._causedByUser)
                    {
                        UserAccounts.EraseAccountPassword(this.cmbId.Text);
                        UserAccounts.SaveToLocal();
                    }
                }
            }
            catch (Exception exception)
            {
                UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception);
            }
        }

        internal bool CheckInput(out long id, out string password)
        {
            id = 0;
            password = this.tbPassword.Text;
            if (this.cmbId.Text.Length <= 0)
            {
                this.ShowErrorTip(StringTable.User.MsgEmptyId, this.cmbId);
                return false;
            }
            char ch = this.cmbId.Text[0];
            bool flag = ((ch < '1') || (ch > '9')) || !long.TryParse(this.cmbId.Text, ref id);
            bool flag2 = password.Length <= 0;
            bool flag3 = ImpsHelper.IsSid(id);
            bool flag4 = ImpsHelper.IsCmccMobileNo(id);
            if ((flag || (id <= 0)) || (!flag3 && !flag4))
            {
                this.ShowErrorTip(StringTable.User.MsgInvalidId, this.cmbId);
                return false;
            }
            if (flag2)
            {
                this.ShowErrorTip(StringTable.User.MsgInvalidPassword, this.tbPassword);
                return false;

⌨️ 快捷键说明

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