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

📄 entrypointcontrol.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 4 页
字号:
            e.Control.KeyPress -= new KeyPressEventHandler(this.Child_KeyPress);
            base.OnControlRemoved(e);
        }

        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            this.InnerOnKeyPress(e);
            base.OnKeyPress(e);
        }

        private void rbPublic_CheckedChanged(object sender, EventArgs e)
        {
            this.EnableControls(this.cmbId.Enabled);
            if (this.rbPublic.Checked)
            {
                this._causedByUser = false;
                this.cbSaveAccount.Checked = false;
                this.cbSavePassword.Checked = false;
                this.cbSaveAccount.Checked = false;
                this._causedByUser = true;
            }
        }

        private void RearrangeControls()
        {
            base.SuspendLayout();
            try
            {
                int left;
                int y = 20;
                Size clientSize = base.ClientSize;
                bool flag = clientSize.Height >= this.HeightShowPortrait;
                bool flag2 = clientSize.Width >= this.WidthShowProvisioning;
                bool flag3 = clientSize.Height >= this.HeightShowSaveInfo;
                bool flag4 = clientSize.Height >= this.HeightShowButton;
                this.pbPortrait.Visible = flag;
                this.llProvisioning.Visible = flag2;
                this.llForgetPass.Visible = flag2;
                this.cbAutoLogin.Visible = flag3;
                this.llEraseInfo.Visible = flag3 && flag2;
                this.cbSaveAccount.Visible = flag3;
                this.cbSavePassword.Visible = flag3;
                this.rbPrivate.Visible = flag3;
                this.rbPublic.Visible = flag3;
                this.btnLogin.Visible = flag4;
                if (flag)
                {
                    left = (clientSize.Width - this.pbPortrait.Width) / 2;
                    this.pbPortrait.SetBounds(left, y, 0, 0, BoundsSpecified.Location);
                    y = this.pbPortrait.Bottom + 20;
                }
                left = 0x18;
                int num3 = clientSize.Width - 0x18;
                int width = num3 - 0x18;
                if (flag2)
                {
                    width -= 5 + this.WidthMaxProvisioning;
                }
                if (width > 150)
                {
                    int num7 = (width - 150) / 2;
                    left += num7;
                    num3 -= num7;
                    width = 150;
                }
                this.lblId.SetBounds(left, y, 0, 0, BoundsSpecified.Location);
                y = this.lblId.Bottom + 3;
                int num4 = y;
                this.cmbId.SetBounds(left, num4, width, 0, BoundsSpecified.Width | BoundsSpecified.Location);
                y = this.cmbId.Bottom + 3;
                this.lblPassword.SetBounds(left, y, 0, 0, BoundsSpecified.Location);
                y = this.lblPassword.Bottom + 3;
                int num5 = y;
                this.tbPassword.SetBounds(left, num5, width, 0, BoundsSpecified.Width | BoundsSpecified.Location);
                y = this.tbPassword.Bottom + 15;
                this.lbInitStatus.SetBounds(left, y, 0, 0, BoundsSpecified.Location);
                this.InitStatus.SetBounds(this.lbInitStatus.Right + 5, y - ((this.InitStatus.Height - this.lbInitStatus.Height) / 2), 0, 0, BoundsSpecified.Location);
                if (flag2)
                {
                    left += width + 5;
                    this.llProvisioning.SetBounds(left, this.cmbId.Top + ((this.cmbId.Height - this.llProvisioning.Height) / 2), 0, 0, BoundsSpecified.Location);
                    this.llForgetPass.SetBounds(left, this.tbPassword.Top + ((this.tbPassword.Height - this.llForgetPass.Height) / 2), 0, 0, BoundsSpecified.Location);
                }
                if (flag4)
                {
                    y = this.tbPassword.Bottom + 30;
                    left = this.cmbId.Left;
                    int num8 = (left + ((int) ((num3 - left) * 0.5))) - (this.btnLogin.Width / 2);
                    left = (num3 - 0x18) - this.btnLogin.Width;
                    if (num8 < left)
                    {
                        left = num8;
                    }
                    this.lblStep.SetBounds(left, y, 0, 0, BoundsSpecified.Location);
                    y += (this.lblId.Height + 3) + 3;
                    this.btnLogin.SetBounds(left, y, 0, 0, BoundsSpecified.Location);
                    y = (this.btnLogin.Bottom + 3) + 3;
                    left += (this.btnLogin.Width - this.llNetSetting.Width) / 2;
                    this.llNetSetting.SetBounds(left, y, 0, 0, BoundsSpecified.Location);
                    this.llReconnectAtOnce.SetBounds(left, y, 0, 0, BoundsSpecified.Location);
                }
                if (flag3)
                {
                    left = this.lblId.Left + 0x18;
                    y = (clientSize.Height - 20) - this.cbAutoLogin.Height;
                    this.cbAutoLogin.SetBounds(left, y, 0, 0, BoundsSpecified.Location);
                    y -= this.cbSavePassword.Height + 3;
                    this.cbSavePassword.SetBounds(left, y, 0, 0, BoundsSpecified.Location);
                    y -= this.cbSaveAccount.Height + 3;
                    this.cbSaveAccount.SetBounds(left, y, 0, 0, BoundsSpecified.Location);
                    if (flag2)
                    {
                        this.llEraseInfo.SetBounds(this.cbSaveAccount.Right, this.cbSaveAccount.Top + ((this.cbSaveAccount.Height - this.llEraseInfo.Height) / 2), 0, 0, BoundsSpecified.Location);
                        this.llEraseInfo.Visible = this.llEraseInfo.Right < (base.Width - 0x18);
                    }
                    left = this.lblId.Left;
                    y -= this.rbPrivate.Height + 3;
                    this.rbPrivate.SetBounds(left, y, 0, 0, BoundsSpecified.Location);
                    y -= this.rbPublic.Height + 3;
                    this.rbPublic.SetBounds(left, y, 0, 0, BoundsSpecified.Location);
                }
            }
            catch
            {
            }
            finally
            {
                base.ResumeLayout(false);
            }
        }

        private void ResetCheckBox()
        {
            this.rbPrivate.Checked = true;
            this.cbSaveAccount.Checked = true;
            this.cbSavePassword.Checked = true;
            this.cbAutoLogin.Checked = true;
        }

        private void ShowErrorTip(string text, Control ctrl)
        {
            if (ctrl is TextBoxBase)
            {
                ((TextBoxBase) ctrl).SelectAll();
            }
            else if (ctrl is ComboBox)
            {
                ((ComboBox) ctrl).SelectAll();
            }
            ctrl.Focus();
            BalloonHelper.ShowBallon(ctrl, text, StringTable.User.MsgErrorTitle, ToolTipIcon.Error, new Point(10, 5), 0x7d0);
        }

        private void ShowNetworkSetting(bool show)
        {
            this.llNetSetting.Visible = show;
            this.llReconnectAtOnce.Visible = !show && NetworkInterface.GetIsNetworkAvailable();
        }

        private static void SortIds(string[] ids)
        {
            int length = ids.Length;
            for (int i = 0; i < (length - 1); i++)
            {
                int num1 = ids[i].Length;
                for (int j = i + 1; j < length; j++)
                {
                    if (CompareIds(ids[i], ids[j]) > 0)
                    {
                        string str = ids[i];
                        ids[i] = ids[j];
                        ids[j] = str;
                    }
                }
            }
        }

        private void StartReconnect()
        {
            if (this.autoReconnect.NextInterval > 0)
            {
                ClientLogger.WriteGeneral("开始自动重连!");
                this._manager.CurrentUser.Status = UserAccountStatus.WaitReconnect;
                this.autoReconnect.StartTimer();
            }
        }

        private void tbPassword_TextChanged(object sender, EventArgs e)
        {
            try
            {
                this.EnableControls(this.cmbId.Enabled);
            }
            catch
            {
            }
        }

        private void TryAutoLogin()
        {
            if ((this.cbAutoLogin.Checked && (this.cmbId.Text.Length > 0)) && (this.tbPassword.Text.Length > 0))
            {
                this.DoLogin(true);
            }
        }

        private void TryFillRelatedInfo()
        {
            try
            {
                this._causedByUser = false;
                base.SuspendLayout();
                this.HideErrorTip();
                string text = this.cmbId.Text;
                UserAccounts.AccountData account = UserAccounts.GetAccount(text);
                bool flag = null != account;
                this.TryLoadPortrait(flag ? account.Id : null);
                this._initPresence = MainPresence.Online;
                if (flag)
                {
                    this.rbPrivate.Checked = true;
                    this.cbSaveAccount.Checked = true;
                    this.tbPassword.Text = account.Password;
                    bool flag2 = !string.IsNullOrEmpty(account.Password);
                    this.cbSavePassword.Checked = flag2;
                    this.cbAutoLogin.Checked = flag2 && account.AutoLogin;
                    try
                    {
                        this._initPresence = (MainPresence) Enum.Parse(typeof(MainPresence), account.PresenceValue.ToString());
                    }
                    catch
                    {
                    }
                }
                else if (text.Length <= 0)
                {
                    this.tbPassword.Text = string.Empty;
                }
                else if (IsIdCompleted(text))
                {
                    this.tbPassword.Text = string.Empty;
                }
                this.InitStatus.OnlineStatusText = MainPresenceHelper.MainPresence2Str(this._initPresence);
            }
            catch
            {
            }
            finally
            {
                base.ResumeLayout(false);
                this._causedByUser = true;
            }
        }

        private void TryLoadPortrait(string id)
        {
            Image objB = null;
            long mappedSid;
            if (!string.IsNullOrEmpty(id) && long.TryParse(id, out mappedSid))
            {
                if (mappedSid >= 0x2540be400L)
                {
                    mappedSid = UserAccounts.GetMappedSid(mappedSid.ToString());
                }
                if (mappedSid > 0L)
                {
                    IicUri uri = IicUri.CreateSidUri((long) ((int) mappedSid));
                    try
                    {
                        if (this._manager.CurrentUser != null)
                        {
                            int num2;
                            this._manager.FrameworkWnd.PersistentManager.LoadById(mappedSid);
                            objB = this._manager.FrameworkWnd.PersistentManager.LoadPortrait(uri, out num2);
                        }
                    }
                    catch
                    {
                    }
                }
            }
            if (objB == null)
            {
                objB = this.DefaultPortrait;
            }
            if (!object.Equals(this._curPortrait, objB))
            {
                this._curPortrait = objB;
                ControlHelper.FadeinImage(this.pbPortrait, objB);
            }
        }

        private void UpdateStepLabelText(string newLabelText)
        {
            this.lblStep.Text = newLabelText;
        }

        public bool AutoLogin
        {
            get
            {
                return this.cbAutoLogin.Checked;
            }
            set
            {
                this.cbAutoLogin.Checked = value;
            }
        }

        public string CurrentId
        {
            get
            {
                return this.cmbId.Text;
            }
        }

        public Image DefaultPortrait
        {
            get
            {
                if (this._defaultPortrait == null)
                {
                    this._defaultPortrait = ImpsPortrait.GetDefaultPortrait(0x60, 0x60);
                }
                return this._defaultPortrait;
            }
        }

        private int WidthMaxProvisioning
        {
            get
            {
                return Math.Max(this.llProvisioning.Width, this.llForgetPass.Width);
            }
        }
    }
}

⌨️ 快捷键说明

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