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

📄 entrypointcontrol.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 4 页
字号:
        {
            if (this.btnLogin.Text == StringTable.EP_BtnCancel)
            {
                this.StartReconnect();
            }
        }

        private void CurrentUser_LoginStepChanged(object sender, EventArgs e)
        {
            try
            {
                this.UpdateStepLabelText(this._manager.CurrentUser.LoginStep);
            }
            catch
            {
            }
        }

        private void CurrentUser_StatusChanged(object sender, UserSatusChangedEventArgs e)
        {
            try
            {
                switch (e.NewStatus)
                {
                    case UserAccountStatus.Initialized:
                        this.btnLogin.Text = StringTable.EP_BtnLogin;
                        this.EnableControls(true);
                        this.ShowNetworkSetting(true);
                        goto Label_0198;

                    case UserAccountStatus.Loginning:
                        this.btnLogin.Text = StringTable.EP_BtnCancel;
                        this.EnableControls(false);
                        this.ShowNetworkSetting(true);
                        goto Label_0198;

                    case UserAccountStatus.Logon:
                        this.autoReconnect.StopTimer(true);
                        if (!this.rbPublic.Checked && this.cbSaveAccount.Checked)
                        {
                            break;
                        }
                        this.cmbId.Text = string.Empty;
                        this.tbPassword.Text = string.Empty;
                        goto Label_0141;

                    case UserAccountStatus.Logouting:
                        this.TryLoadPortrait(this.cmbId.Text);
                        this.ShowNetworkSetting(true);
                        this.UpdateStepLabelText(string.Empty);
                        goto Label_0198;

                    case UserAccountStatus.Disconnected:
                        this.btnLogin.Text = StringTable.EP_BtnCancel;
                        this.EnableControls(false);
                        this.ShowNetworkSetting(false);
                        this.StartReconnect();
                        goto Label_0198;

                    case UserAccountStatus.WaitReconnect:
                        this.EnableControls(false);
                        this.ShowNetworkSetting(false);
                        this.btnLogin.Text = StringTable.EP_BtnCancel;
                        this.AR_OnTick(this, null);
                        goto Label_0198;

                    default:
                        this.btnLogin.Text = StringTable.EP_BtnLogin;
                        this.UpdateStepLabelText(string.Empty);
                        this.EnableControls(true);
                        this.ShowNetworkSetting(true);
                        goto Label_0198;
                }
                if (!this.cbSavePassword.Checked)
                {
                    this.tbPassword.Text = string.Empty;
                }
                else
                {
                    this.cbAutoLogin.Checked = UserAccounts.LatestAccountAutoLogin;
                }
            Label_0141:
                this.ShowNetworkSetting(true);
            Label_0198:
                this._suspendIdChanged = false;
            }
            catch (Exception exception)
            {
                UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception);
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void DoLocalize()
        {
            this.btnLogin.Text = StringTable.EP_BtnLogin;
        }

        internal bool DoLogin()
        {
            return this.DoLogin(false);
        }

        private bool DoLogin(bool auto)
        {
            try
            {
                long num;
                string str;
                if (!this.CheckInput(out num, out str))
                {
                    return false;
                }
                NotifyWindowManager.Clear();
                this.btnLogin.Focus();
                this.cmbId.Select(0, 0);
                this._manager.LoginAs(num, str, this._initPresence, auto);
                string text = this.cmbId.Text;
                bool flag = this.rbPrivate.Checked && this.cbSaveAccount.Checked;
                this._manager.CurrentUser.Configuration.UserSetting.SaveMyInfo = flag;
                if (flag)
                {
                    string pass = this.cbSavePassword.Checked ? this.tbPassword.Text : string.Empty;
                    UserAccounts.AccountData data = new UserAccounts.AccountData(text, pass, this.cbAutoLogin.Checked, this._initPresence);
                    UserAccounts.LastestAccount = data;
                    if (!this.cmbId.Items.Contains(text))
                    {
                        int index = this.FindInsertIndexOfId(text);
                        if (index < 0)
                        {
                            this.cmbId.Items.Add(text);
                        }
                        else
                        {
                            this.cmbId.Items.Insert(index, text);
                        }
                    }
                }
                else
                {
                    UserAccounts.LastestAccount = null;
                    UserAccounts.EraseAccountElement(text);
                    UserAccounts.LatestId = string.Empty;
                    UserAccounts.SaveToLocal();
                    this._suspendIdChanged = true;
                    this.cmbId.Items.Remove(text);
                    if (this.cmbId.Text.Length <= 0)
                    {
                        this.cmbId.Text = text;
                    }
                    this._suspendIdChanged = false;
                }
                return true;
            }
            catch (Exception exception)
            {
                this._manager.FrameworkWnd.UnifiedMessageBox.ShowException(exception);
                ClientLogger.WriteException(exception);
                return false;
            }
        }

        private void DoLoginOrCancel()
        {
            if (this.btnLogin.Text == StringTable.EP_BtnLogin)
            {
                this.DoLogin();
            }
            else
            {
                this.CancelLogin();
                this.ShowNetworkSetting(true);
            }
        }

        private void EnableControls(bool enabled)
        {
            this.cmbId.Enabled = enabled;
            this.tbPassword.Enabled = enabled;
            this.llForgetPass.Enabled = enabled;
            this.llNetSetting.Enabled = enabled;
            this.llProvisioning.Enabled = enabled;
            this.lblId.Enabled = enabled;
            this.lblPassword.Enabled = enabled;
            this.rbPrivate.Enabled = enabled;
            this.rbPublic.Enabled = enabled;
            enabled = enabled && this.rbPrivate.Checked;
            this.cbSaveAccount.Enabled = enabled;
            this.llEraseInfo.Enabled = enabled;
            this.cbSavePassword.Enabled = enabled;
            this.cbAutoLogin.Enabled = enabled;
            this.lbInitStatus.Enabled = enabled;
            this.InitStatus.Enabled = this.tbPassword.Enabled;
        }

        private void EntryPointControl_SizeChanged(object sender, EventArgs e)
        {
            this.RearrangeControls();
        }

        private void EntryPointControl_VisibleChanged(object sender, EventArgs e)
        {
            try
            {
                this._manager.FrameworkWnd.MainWindow.AcceptButton = base.Visible ? this.btnLogin : null;
            }
            catch
            {
            }
        }

        internal void FillUserIdAndPassword(string id, string pass)
        {
            this.cmbId.Text = id;
            this.tbPassword.Text = pass;
        }

        private int FindInsertIndexOfId(string id)
        {
            for (int i = 0; i < this.cmbId.Items.Count; i++)
            {
                string str = (string) this.cmbId.Items[i];
                if (CompareIds(str, id) > 0)
                {
                    return i;
                }
            }
            return -1;
        }

        private void FrameworkWnd_BeginSuspend(object sender, EventArgs e)
        {
            try
            {
                if ((this._manager.CurrentUser.Status == UserAccountStatus.WaitReconnect) && !this.AutoLogin)
                {
                    ClientLogger.WriteBizOperation("开始休眠,清除倒计时!");
                    if (this.autoReconnect != null)
                    {
                        this.autoReconnect.StopTimer(true);
                    }
                }
                this.ShowNetworkSetting(true);
            }
            catch (Exception)
            {
            }
        }

        private void FrameworkWnd_Loaded(object sender, EventArgs e)
        {
            try
            {
                this.LoadUserAccounts();
                this.TryAutoLogin();
            }
            catch (Exception exception)
            {
                UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception);
            }
        }

        private void FrameworkWnd_SuspendRestored(object sender, EventArgs e)
        {
            try
            {
                ClientLogger.WriteBizOperation("休眠恢复!");
                this.TryAutoLogin();
            }
            catch
            {
            }
        }

        private void HideErrorTip()
        {
            BalloonHelper.RemoveAll();
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(EntryPointControl));
            this.cbAutoLogin = new CheckBox();
            this.cbSavePassword = new CheckBox();
            this.cbSaveAccount = new CheckBox();
            this.rbPrivate = new RadioButton();
            this.rbPublic = new RadioButton();
            this.InitStatus = new BDisplayNameAndOnlineStatus();
            this.InitStatusMenu = new menu_widget(this.components);
            this.cmbId = new XComboBox();
            this.tbPassword = new XTextBox();
            this.btnLogin = new XButton();
            base.SuspendLayout();
            this.cbAutoLogin.AutoSize = true;
            this.cbAutoLogin.FlatStyle = FlatStyle.Flat;
            this.cbAutoLogin.Location = new Point(13, 0x14d);
            this.cbAutoLogin.Name = "cbAutoLogin";
            this.cbAutoLogin.Size = new Size(0x47, 0x11);
            this.cbAutoLogin.TabIndex = 7;
            this.cbAutoLogin.Text = "自动登录";
            this.cbAutoLogin.UseVisualStyleBackColor = true;
            this.cbAutoLogin.CheckedChanged += new EventHandler(this.cbAutoLogin_CheckedChanged);
            this.cbSavePassword.AutoSize = true;
            this.cbSavePassword.FlatStyle = FlatStyle.Flat;
            this.cbSavePassword.Location = new Point(13, 310);
            this.cbSavePassword.Name = "cbSavePassword";
            this.cbSavePassword.Size = new Size(0x5f, 0x11);
            this.cbSavePassword.TabIndex = 6;
            this.cbSavePassword.Text = "记住我的密码";
            this.cbSavePassword.UseVisualStyleBackColor = true;
            this.cbSavePassword.CheckedChanged += new EventHandler(this.cbSavePassword_CheckedChanged);
            this.cbSaveAccount.AutoSize = true;
            this.cbSaveAccount.FlatStyle = FlatStyle.Flat;
            this.cbSaveAccount.Location = new Point(13, 0x11f);
            this.cbSaveAccount.Name = "cbSaveAccount";
            this.cbSaveAccount.Size = new Size(0x5f, 0x11);
            this.cbSaveAccount.TabIndex = 5;
            this.cbSaveAccount.Text = "保存我的信息";
            this.cbSaveAccount.UseVisualStyleBackColor = true;
            this.cbSaveAccount.CheckedChanged += new EventHandler(this.cbSaveAccount_CheckedChanged);
            this.rbPrivate.AutoSize = true;
            this.rbPrivate.Checked = true;
            this.rbPrivate.FlatStyle = FlatStyle.Flat;
            this.rbPrivate.Location = new Point(4, 0x108);
            this.rbPrivate.Name = "rbPrivate";
            this.rbPrivate.Size = new Size(0x54, 0x11);
            this.rbPrivate.TabIndex = 4;
            this.rbPrivate.TabStop = true;
            this.rbPrivate.Text = "私有计算机";
            this.rbPrivate.UseVisualStyleBackColor = true;
            this.rbPublic.AutoSize = true;
            this.rbPublic.FlatStyle = FlatStyle.Flat;

⌨️ 快捷键说明

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